mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-06 03:34:40 +00:00
fix: tutorials show room as N/A even if room is specified on timetable
This commit is contained in:
@@ -299,7 +299,6 @@ function comparedate(obj1: any, obj2: any) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function processNotices(response: any, labelArray: string[]) {
|
function processNotices(response: any, labelArray: string[]) {
|
||||||
const NoticeContainer = document.getElementById("notice-container");
|
const NoticeContainer = document.getElementById("notice-container");
|
||||||
if (!NoticeContainer) return;
|
if (!NoticeContainer) return;
|
||||||
@@ -343,13 +342,13 @@ function processNoticeColor(colour: string): string | undefined {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function createNoticeElement(notice: any, colour: string | undefined): Node {
|
function createNoticeElement(notice: any, colour: string | undefined): Node {
|
||||||
const textPreview = notice.contents
|
const textPreview =
|
||||||
|
notice.contents
|
||||||
.replace(/<[^>]*>/g, "")
|
.replace(/<[^>]*>/g, "")
|
||||||
.replace(/\[\[[\w]+[:][\w]+[\]\]]+/g, "")
|
.replace(/\[\[[\w]+[:][\w]+[\]\]]+/g, "")
|
||||||
.replace(/\s+/g, " ")
|
.replace(/\s+/g, " ")
|
||||||
.trim()
|
.trim()
|
||||||
.substring(0, 150)
|
.substring(0, 150) + (notice.contents.length > 150 ? "..." : "");
|
||||||
+ (notice.contents.length > 150 ? "..." : "");
|
|
||||||
|
|
||||||
const noticeId = `notice-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
const noticeId = `notice-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
||||||
|
|
||||||
@@ -680,8 +679,10 @@ function callHomeTimetable(date: string, change?: any) {
|
|||||||
GetLessonColours().then((colours) => {
|
GetLessonColours().then((colours) => {
|
||||||
let subjects = colours;
|
let subjects = colours;
|
||||||
for (let i = 0; i < lessonArray.length; i++) {
|
for (let i = 0; i < lessonArray.length; i++) {
|
||||||
|
let subjectname =
|
||||||
let subjectname = ((lessonArray[i].type == "tutorial") ? `timetable.tutor.${lessonArray[i].tutorID}` : `timetable.subject.colour.${lessonArray[i].code}`);
|
lessonArray[i].type == "tutorial"
|
||||||
|
? `timetable.tutor.${lessonArray[i].tutorID}`
|
||||||
|
: `timetable.subject.colour.${lessonArray[i].code}`;
|
||||||
|
|
||||||
let subject = subjects.find(
|
let subject = subjects.find(
|
||||||
(element: any) => element.name === subjectname,
|
(element: any) => element.name === subjectname,
|
||||||
@@ -869,14 +870,14 @@ function makeLessonDiv(lesson: any, num: number) {
|
|||||||
programmeID,
|
programmeID,
|
||||||
metaID,
|
metaID,
|
||||||
assessments,
|
assessments,
|
||||||
type
|
type,
|
||||||
} = lesson;
|
} = lesson;
|
||||||
|
|
||||||
let lessonString = `
|
let lessonString = `
|
||||||
<div class="day" id="${code + num}" style="${colour}">
|
<div class="day" id="${code + num}" style="${colour}">
|
||||||
<h2>${(type == "class") ? description : (type == "tutorial") ? "Tutorial" : "Unknown"}</h2>
|
<h2>${type == "class" ? description : type == "tutorial" ? "Tutorial" : "Unknown"}</h2>
|
||||||
<h3>${staff || "Unknown"}</h3>
|
<h3>${staff || "Unknown"}</h3>
|
||||||
<h3>${(type == "class") ? room : (type == "tutorial") ? "N/A" : "Unknown"}</h3>
|
<h3>${room || "N/A"}</h3>
|
||||||
<h4>${from || "Unknown"} - ${until || "Unknown"}</h4>
|
<h4>${from || "Unknown"} - ${until || "Unknown"}</h4>
|
||||||
<h5>${attendanceTitle || "Unknown"}</h5>
|
<h5>${attendanceTitle || "Unknown"}</h5>
|
||||||
`;
|
`;
|
||||||
@@ -987,22 +988,16 @@ async function CreateUpcomingSection(assessments: any, activeSubjects: any) {
|
|||||||
|
|
||||||
CreateFilters(activeSubjects);
|
CreateFilters(activeSubjects);
|
||||||
|
|
||||||
let type;
|
|
||||||
let class_;
|
|
||||||
|
|
||||||
for (let i = 0; i < assessments.length; i++) {
|
for (let i = 0; i < assessments.length; i++) {
|
||||||
const element: any = assessments[i];
|
const element: any = assessments[i];
|
||||||
if (!upcomingDates[element.due as keyof typeof upcomingDates]) {
|
if (!upcomingDates[element.due as keyof typeof upcomingDates]) {
|
||||||
let dateObj: any = new Object();
|
const dateObj: any = {};
|
||||||
dateObj.div = CreateElement(
|
dateObj.div = CreateElement("div", "upcoming-date-container");
|
||||||
(type = "div"),
|
|
||||||
(class_ = "upcoming-date-container"),
|
|
||||||
);
|
|
||||||
dateObj.assessments = [];
|
dateObj.assessments = [];
|
||||||
(upcomingDates[element.due as keyof typeof upcomingDates] as any) =
|
(upcomingDates[element.due as keyof typeof upcomingDates] as any) =
|
||||||
dateObj;
|
dateObj;
|
||||||
}
|
}
|
||||||
let assessmentDateDiv =
|
const assessmentDateDiv =
|
||||||
upcomingDates[element.due as keyof typeof upcomingDates];
|
upcomingDates[element.due as keyof typeof upcomingDates];
|
||||||
|
|
||||||
if (assessmentDateDiv) {
|
if (assessmentDateDiv) {
|
||||||
@@ -1012,9 +1007,8 @@ async function CreateUpcomingSection(assessments: any, activeSubjects: any) {
|
|||||||
|
|
||||||
for (var date in upcomingDates) {
|
for (var date in upcomingDates) {
|
||||||
let assessmentdue = new Date(
|
let assessmentdue = new Date(
|
||||||
(
|
(upcomingDates[date as keyof typeof upcomingDates] as any).assessments[0]
|
||||||
upcomingDates[date as keyof typeof upcomingDates] as any
|
.due,
|
||||||
).assessments[0].due,
|
|
||||||
);
|
);
|
||||||
let specialcase = CheckSpecialDay(Today, assessmentdue);
|
let specialcase = CheckSpecialDay(Today, assessmentdue);
|
||||||
let assessmentDate;
|
let assessmentDate;
|
||||||
|
|||||||
Reference in New Issue
Block a user