@royalschedule/maps 4.0.33 → 4.0.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -176,7 +176,7 @@ var schedules_default = (data, options = {}) => {
176
176
  "Week (7109)": "",
177
177
  "ActualWeeks (7167)": period?.ranges?.map((range) => `${moment.utc(range.start).week()}-${moment.utc(range.end).week()}`).join(",")
178
178
  };
179
- }) ?? [];
179
+ }).filter(Boolean) ?? [];
180
180
  csv += `${papaOptions.newline}Lesson (7100)${papaOptions.newline}[Rows]${papaOptions.newline}`;
181
181
  if (e.length) csv += Papa.unparse(e, papaOptions);
182
182
  else csv += [
@@ -1 +1 @@
1
- {"version":3,"file":"schedules.js","names":["teachers","groups","locations"],"sources":["../../../../src/Skola24/txt/to/schedules.ts"],"sourcesContent":["import Papa from 'papaparse';\nimport moment from 'moment';\nimport { isString } from 'lodash-es';\nimport type { Types as MongooseTypes } from 'mongoose';\nimport { isObjectIdOrHexString } from 'mongoose';\nimport type { CoreTypes } from '../../../core';\nimport type { BaseOptions } from '../../../common/types';\nimport { getVertexId } from '../../../core/util';\n\nconst papaOptions = {\n quotes: false, //or array of booleans\n quoteChar: '\"',\n escapeChar: '\"',\n delimiter: '\\t',\n header: true,\n newline: '\\r\\n',\n skipEmptyLines: false, //other option is 'greedy', meaning skip delimiters, quotes, and whitespace.\n // columns: null //or array of strings\n} as Papa.UnparseConfig;\n\nconst uuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;\n\nexport default (\n data: CoreTypes.Mixed.Schedule,\n options: BaseOptions = {}\n): string => {\n const { locations, teachers, groups, persons, events, courses, periods, syllabuses, divisions } = data;\n const { start, /* end, */ displayName } = divisions ?? data as unknown as CoreTypes.Mixed.Division;\n\n const startYear = moment.utc(start).year();\n const startMonth = moment.utc(start).month();\n\n // Set cvs to the source section\n let csv = `[Source]${papaOptions.newline}ApplicationVerMajor=4${papaOptions.newline}ApplicationVerMinor=0${papaOptions.newline}DatabaseRevNo=527${papaOptions.newline}CurrentNovaschemDatabase=${papaOptions.newline}User=${papaOptions.newline}`;\n csv += `SchoolID=RS${papaOptions.newline}School=${displayName}${papaOptions.newline}County=RS${papaOptions.newline}`;\n csv += `BaseYear=${startYear}${papaOptions.newline}OffsetYear=0${papaOptions.newline}OffsetMonth=${startMonth}${papaOptions.newline}CreationDate=${moment().format('YYYY-MM-DD')}${papaOptions.newline}${papaOptions.newline}`;\n // add destination section to csv\n csv += `[Destination]${papaOptions.newline}Application=${papaOptions.newline}ApplicationID=${papaOptions.newline}${papaOptions.newline}`;\n\n // add database options to csv\n csv += `[DatabaseOptions]${papaOptions.newline}Update=TRUE${papaOptions.newline}AddNew=TRUE${papaOptions.newline}${papaOptions.newline}`;\n\n // start tables section\n csv += `[Tables]${papaOptions.newline}${papaOptions.newline}`;\n\n // append teachers to csv\n const t = teachers?.map(teacher => {\n return {\n 'Teacher (6001)': teacher.signature,\n 'GUID (5800)': (teacher.ids && uuid.test(teacher.ids)) ? `{${teacher.ids}}` : '',\n 'Category (6002)': '',\n 'Title (6006)': '',\n 'Phone (6033)': '',\n 'EvaluationNumber (6014)': '',\n ... 'person' in teacher && typeof teacher.person == 'object'\n ? {\n 'PersonalCode (6028)': 'SSN' in teacher.person ? (teacher.person?.SSN?.value ?? '') : '',\n 'LastName (6003)': 'lastName' in teacher.person ? (teacher.person?.lastName ?? '') : '',\n 'FirstName (6004)': 'firstName' in teacher.person ? (teacher.person?.firstName ?? '') : '',\n 'EMail (6034)': 'emails' in teacher.person ? (teacher.person?.emails?.[0]?.value ?? '') : '',\n }\n : null\n };\n }) ?? [];\n csv += `${papaOptions.newline}Teacher (6000)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (t.length) {\n csv += Papa.unparse(t, papaOptions);\n } else {\n csv += ['Teacher (6001)', 'GUID (5800)', 'Category (6002)', 'PersonalCode (6028)', 'LastName (6003)', 'Title (6006)', 'FirstName (6004)', 'Phone (6033)', 'EMail (6034)', 'EvaluationNumber (6014)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n // append students to csv\n const s = persons?.filter(person => {\n return person.type != 'Teacher';\n }).map(person => {\n return {\n 'Student (7201)': person.SSN?.value,\n 'GUID (5800)': (person.ids && uuid.test(person.ids)) ? `{${person.ids}}` : '',\n 'Category (7305)': '',\n 'LastName (7202)': person.lastName ?? '',\n 'FirstName (7211)': person.firstName ?? '',\n 'EMail (7215)': person.emails?.[0]?.value ?? ''\n };\n }) ?? [];\n csv += `${papaOptions.newline}Student (7200)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (s.length) {\n csv += Papa.unparse(s, papaOptions);\n } else {\n csv += ['Student (7201)', 'GUID (5800)', 'Category (7305)', 'LastName (7202)', 'FirstName (7211)', 'EMail (7215)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n // create a map of students.id to students.SSN\n const studentMap = new Map(persons?.filter(x => x.type != 'Teacher').map(x => [getVertexId(x, options), x.SSN?.value ?? '']));\n\n // append groups to csv\n const g = groups?.map(group => {\n return {\n 'Group (6201)': group.displayName!,\n 'GUID (5800)': (group.ids && uuid.test(group.ids)) ? `{${group.ids}}` : '',\n 'Class (6210)': group.species == 'class' ? 1 : 0,\n 'Teacher (6204)': '',\n 'IClass (6206)': '',\n 'Student (6205)': group.members?.map(x => getVertexId(x, options)).map(x => studentMap.get(x)).filter(Boolean).join(',')\n };\n }) ?? [];\n csv += `${papaOptions.newline}Group (6200)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (g.length) {\n csv += Papa.unparse(g, papaOptions);\n } else {\n csv += ['Group (6201)', 'GUID (5800)', 'Class (6210)', 'Teacher (6204)', 'IClass (6206)', 'Student (6205)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n // append locations to csv\n const l = locations?.map(location => {\n return {\n 'Room (6601)': location.displayName!,\n 'GUID (5800)': (location.ids && uuid.test(location.ids)) ? `{${location.ids}}` : '',\n 'Category (6602)': location.tags?.find(tag => tag.type == 'category')?.value ?? '',\n 'SeatingCapacity (6607)': location.maximumCapacity,\n };\n }) ?? [];\n csv += `${papaOptions.newline}Room (6600)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (l.length) {\n csv += Papa.unparse(l, papaOptions);\n } else {\n csv += ['Room (6601)', 'GUID (5800)', 'Category (6602)', 'SeatingCapacity (6607)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n // append periods to csv\n const p = periods?.map(period => {\n return {\n 'Period (8001)': period.displayName!,\n 'GUID (5800)': (period.ids && uuid.test(period.ids)) ? `{${period.ids}}` : '',\n 'TextBelowSchedule (8002)': period.displayName!,\n 'Category (8006)': '',\n 'Calendar (8005)': period.ranges?.map(range => `${moment.utc(range.start).format('D/M')}-${moment.utc(range.end).format('D/M')}`).join(', ')\n };\n }) ?? [];\n csv += `${papaOptions.newline}Period (8000)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (p.length) {\n csv += Papa.unparse(p, papaOptions);\n } else {\n csv += ['Period (8001)', 'GUID (5800)', 'TextBelowSchedule (8002)', 'Category (8006)', 'Calendar (8005)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n const courseMap = new Map(data.courses ?.map(x => [getVertexId(x, options), x]));\n const periodMap = new Map(data.periods ?.map(x => [getVertexId(x, options), x]));\n const teacherMap = new Map(data.teachers ?.map(x => [getVertexId(x, options), x]));\n const groupMap = new Map(data.groups ?.map(x => [getVertexId(x, options), x]));\n const locationMap = new Map(data.locations ?.map(x => [getVertexId(x, options), x]));\n const syllabusMap = new Map(data.syllabuses?.map(x => [getVertexId(x, options), x]));\n\n // append lessons to csv\n const e = events\n // ?.filter(x => !isNaN(Date.parse(x.start?.toString() ?? '')))\n .map((event, index) => {\n if (!event.start || !event.end) return;\n\n const courseId = event.course ? getVertexId(event.course, options) : undefined;\n const course = courseId ? courseMap.get(courseId) : undefined;\n\n // Only use deserialize period\n let period = event.period == null ? course?.period : event.period;\n if (isString(period))\n period = periodMap.get(period);\n if ((period && !('ranges' in period)))\n period = undefined;\n\n // Only use deserialize teachers\n const t = event.teachers == null ? course?.teachers : event.teachers;\n const teacherIds = t?.map(x => getVertexId(x.to, options));\n const teachers = teacherIds?.map(id => teacherMap.get(id)).filter(Boolean) ?? [];\n\n // Only use deserialize groups\n const g = event.groups == null ? course?.groups : event.groups;\n const groupIds = g?.map(x => getVertexId(x.to, options));\n const groups = groupIds?.map(id => groupMap.get(id)).filter(Boolean) ?? [];\n\n // Only use deserialize locations\n const locationIds = event.inLocations?.map(x => x ? getVertexId(x, options) : null).filter(x => x != null);\n const locations = locationIds?.map(id => locationMap.get(id)).filter(Boolean) ?? [];\n const dayOfWeek = moment.utc(event.start).toDate().toLocaleDateString('sv-SE', { weekday: 'long', timeZone: 'UTC' });\n\n // Syllabus of the course\n const syllabusId = isString(course?.syllabus) ? course.syllabus : (course?.syllabus && isObjectIdOrHexString(course?.syllabus)) ? (course?.syllabus as MongooseTypes.ObjectId | string).toString() : undefined;\n const syllabus = syllabusId ? syllabusMap.get(syllabusId) : course?.syllabus as CoreTypes.Deep.Syllabus | undefined;\n\n // capitalize first letter of dayOfWeek\n const dayOfWeekCapitalized = dayOfWeek.charAt(0).toUpperCase() + dayOfWeek.slice(1);\n return {\n 'PK (7100)': index + 1,\n 'GUID (5800)': (event.ids && uuid.test(event.ids)) ? `{${event.ids}}` : '',\n 'DayOfWeek (7101)': dayOfWeekCapitalized,\n 'Starttime (7102)': moment.utc(event.start).format('HH:mm'),\n 'Length (7115)': event.duration,\n 'Course (7106)': syllabus?.courseCode,\n 'Subject (7103)': syllabus?.subjectCode ?? course?.subject ?? '',\n 'Teacher (7104)': teachers ?.map(x => x?.signature ).filter(Boolean).join(','),\n 'Group (7105)': groups ?.map(x => x?.displayName).filter(Boolean).join(','),\n 'Room (7107)': locations?.map(x => x?.displayName).filter(Boolean).join(','),\n 'Period (7108)': '',\n 'Week (7109)': '',\n 'ActualWeeks (7167)': period?.ranges?.map(range => `${moment.utc(range.start).week()}-${moment.utc(range.end).week()}`).join(',')\n };\n }) ?? [];\n csv += `${papaOptions.newline}Lesson (7100)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (e.length) {\n csv += Papa.unparse(e, papaOptions);\n } else {\n csv += ['PK (7100)', 'GUID (5800)', 'DayOfWeek (7101)', 'Starttime (7102)', 'Length (7115)', 'Course (7106)', 'Subject (7103)', 'Period (7108)', 'Week (7109)', 'ActualWeeks (7167)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n // append subjects to csv, is empty for now\n // csv += `Subject (6400)${options.newline}[Rows]${options.newline}`;\n // csv += ['Subject (6401)', 'GUID (5800)', 'Category (6402)', 'FullText (6403)', 'BackgroundColor (6432)', 'TextColor (6433)', 'EvaluationNumber (6429)'].join(options.delimiter);\n // csv += options.newline;\n\n // append syllabus to csv\n const courseSyllabuses = syllabuses?.filter(syllabus => !!syllabus.courseName).map(syllabus => {\n return {\n 'Course (7601)': syllabus.courseCode,\n 'GUID (5800)': syllabus.ids,\n 'FullText (7602)': syllabus.courseName,\n 'Subject (7603)': syllabus.subjectCode ?? '',\n 'Points (7604)': syllabus.points\n };\n }) ?? [];\n csv += `${papaOptions.newline}Course (7600)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (courseSyllabuses.length) {\n csv += Papa.unparse(courseSyllabuses, papaOptions);\n } else {\n csv += ['PK (7100)', 'GUID (5800)', 'DayOfWeek (7101)', 'Starttime (7102)', 'Length (7115)', 'Course (7106)', 'Subject (7103)', 'Period (7108)', 'Week (7109)', 'ActualWeeks (7167)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n const subjectSyllabuses = syllabuses?.reduce((unique, syllabus) => {\n if (syllabus.subjectCode && !unique.seen.has(syllabus.subjectCode)) {\n unique.seen.add(syllabus.subjectCode);\n unique.result.push({\n 'Subject (6401)': syllabus.subjectCode,\n 'GUID (5800)': syllabus.ids,\n 'FullText (6403)': syllabus.subjectName,\n });\n }\n return unique;\n }, {\n seen: new Set<string>(),\n result: [] as Array<{\n 'Subject (6401)': string;\n 'GUID (5800)': string | undefined;\n 'FullText (6403)': string;\n }>\n })?.result ?? [];\n csv += `Subject (6400)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (subjectSyllabuses.length) {\n csv += Papa.unparse(subjectSyllabuses, papaOptions);\n } else {\n csv += ['Subject (6401)', 'GUID (5800)', 'Category (6402)', 'FullText (6403)', 'BackgroundColor (6432)', 'TextColor (6433)', 'EvaluationNumber (6429)'].join(papaOptions.delimiter);\n }\n\n const totalHoursRegex = /(\\d+) hrs/;\n const weekTimeRegex = /(\\d+) min\\/week/;\n const c = courses?.map(course => {\n // Only use deserialize teachers\n const teacherIds = course.teachers?.map(x => getVertexId(x.to, options)).filter(Boolean);\n const teachers = teacherIds?.map(id => teacherMap.get(id)!).filter(Boolean) ?? [];\n\n // Only use deserialize groups\n const groupIds = course.groups?.map(x => getVertexId(x.to, options)).filter(Boolean);\n const groups = groupIds?.map(id => groupMap.get(id)!).filter(Boolean) ?? [];\n\n // Only use deserialize syllabus\n const syllabusId = isString(course?.syllabus) ? course.syllabus : (course?.syllabus && isObjectIdOrHexString(course?.syllabus)) ? (course?.syllabus as MongooseTypes.ObjectId | string).toString() : undefined;\n const syllabus = syllabusId ? syllabusMap.get(syllabusId) : course?.syllabus as CoreTypes.Deep.Syllabus | undefined;\n\n return {\n 'PK (8200)': '',\n 'GUID (5800)': course.ids,\n 'OriginalRecord (8224)': '1',\n 'CreateLesson (8227)': '1',\n 'Course (8202)': syllabus?.courseCode,\n 'Subject (8209)': syllabus?.subjectCode ?? course.subject, // Nikos ansvarig för framtida buggar\n 'Teacher (8210)': teachers?.map(teacher => teacher.signature).filter(Boolean).join(','),\n 'Group (8203)': groups?.map(group => group.displayName).filter(Boolean).join(','),\n 'TotalHours (8204)': (course.plannedDuration && totalHoursRegex.test(course.plannedDuration)) ? totalHoursRegex.exec(course.plannedDuration)![1] : '',\n 'Weektime (8208)': (course.plannedDuration && weekTimeRegex.test(course.plannedDuration)) ? weekTimeRegex.exec(course.plannedDuration)![1] : '',\n 'Blockname (8215)': '',\n 'Period (8206)': '',\n 'Week (8207)': '',\n 'NotPeriod (8212)': '',\n 'NotWeek (8213)': ''\n };\n }) ?? [];\n csv += `${papaOptions.newline}TA (8200)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (c.length) {\n csv += Papa.unparse(c, papaOptions);\n } else {\n csv += ['Course (8202)', 'GUID (5800)', 'Subject (8209)', 'Teacher (8210)', 'Group (8203)', 'TotalHours (8204)', 'Weektime (8208)', 'Blockname (8215)', 'Period (8206)', 'Week (8207)', 'NotPeriod (8212)', 'NotWeek (8213)'].join(papaOptions.delimiter);\n }\n\n return csv;\n};"],"mappings":";;;;;;;AASA,MAAM,cAAc;CAClB,QAAgB;CAChB,WAAgB;CAChB,YAAgB;CAChB,WAAgB;CAChB,QAAgB;CAChB,SAAgB;CAChB,gBAAgB;CAEjB;AAED,MAAM,OAAO;AAEb,yBACE,MACA,UAAuB,EAAE,KACd;CACX,MAAM,EAAE,WAAW,UAAU,QAAQ,SAAS,QAAQ,SAAS,SAAS,YAAY,cAAc;CAClG,MAAM,EAAE,OAAkB,gBAAgB,aAAa;CAEvD,MAAM,YAAa,OAAO,IAAI,MAAM,CAAC,MAAM;CAC3C,MAAM,aAAa,OAAO,IAAI,MAAM,CAAC,OAAO;CAG5C,IAAI,MAAM,WAAW,YAAY,QAAQ,uBAAuB,YAAY,QAAQ,uBAAuB,YAAY,QAAQ,mBAAmB,YAAY,QAAQ,2BAA2B,YAAY,QAAQ,OAAO,YAAY;AACxO,QAAO,cAAc,YAAY,QAAQ,SAAS,cAAc,YAAY,QAAQ,WAAW,YAAY;AAC3G,QAAO,YAAY,YAAY,YAAY,QAAQ,cAAc,YAAY,QAAQ,cAAc,aAAa,YAAY,QAAQ,eAAe,QAAQ,CAAC,OAAO,aAAa,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EAAC;EAAiB;EAAe;EAAkB;EAAkB;EAAgB;EAAqB;EAAmB;EAAoB;EAAiB;EAAe;EAAoB;EAAiB,CAAC,KAAK,YAAY,UAAU;AAG3P,QAAO"}
1
+ {"version":3,"file":"schedules.js","names":["teachers","groups","locations"],"sources":["../../../../src/Skola24/txt/to/schedules.ts"],"sourcesContent":["import Papa from 'papaparse';\nimport moment from 'moment';\nimport { isString } from 'lodash-es';\nimport type { Types as MongooseTypes } from 'mongoose';\nimport { isObjectIdOrHexString } from 'mongoose';\nimport type { CoreTypes } from '../../../core';\nimport type { BaseOptions } from '../../../common/types';\nimport { getVertexId } from '../../../core/util';\n\nconst papaOptions = {\n quotes: false, //or array of booleans\n quoteChar: '\"',\n escapeChar: '\"',\n delimiter: '\\t',\n header: true,\n newline: '\\r\\n',\n skipEmptyLines: false, //other option is 'greedy', meaning skip delimiters, quotes, and whitespace.\n // columns: null //or array of strings\n} as Papa.UnparseConfig;\n\nconst uuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;\n\nexport default (\n data: CoreTypes.Mixed.Schedule,\n options: BaseOptions = {}\n): string => {\n const { locations, teachers, groups, persons, events, courses, periods, syllabuses, divisions } = data;\n const { start, /* end, */ displayName } = divisions ?? data as unknown as CoreTypes.Mixed.Division;\n\n const startYear = moment.utc(start).year();\n const startMonth = moment.utc(start).month();\n\n // Set cvs to the source section\n let csv = `[Source]${papaOptions.newline}ApplicationVerMajor=4${papaOptions.newline}ApplicationVerMinor=0${papaOptions.newline}DatabaseRevNo=527${papaOptions.newline}CurrentNovaschemDatabase=${papaOptions.newline}User=${papaOptions.newline}`;\n csv += `SchoolID=RS${papaOptions.newline}School=${displayName}${papaOptions.newline}County=RS${papaOptions.newline}`;\n csv += `BaseYear=${startYear}${papaOptions.newline}OffsetYear=0${papaOptions.newline}OffsetMonth=${startMonth}${papaOptions.newline}CreationDate=${moment().format('YYYY-MM-DD')}${papaOptions.newline}${papaOptions.newline}`;\n // add destination section to csv\n csv += `[Destination]${papaOptions.newline}Application=${papaOptions.newline}ApplicationID=${papaOptions.newline}${papaOptions.newline}`;\n\n // add database options to csv\n csv += `[DatabaseOptions]${papaOptions.newline}Update=TRUE${papaOptions.newline}AddNew=TRUE${papaOptions.newline}${papaOptions.newline}`;\n\n // start tables section\n csv += `[Tables]${papaOptions.newline}${papaOptions.newline}`;\n\n // append teachers to csv\n const t = teachers?.map(teacher => {\n return {\n 'Teacher (6001)': teacher.signature,\n 'GUID (5800)': (teacher.ids && uuid.test(teacher.ids)) ? `{${teacher.ids}}` : '',\n 'Category (6002)': '',\n 'Title (6006)': '',\n 'Phone (6033)': '',\n 'EvaluationNumber (6014)': '',\n ... 'person' in teacher && typeof teacher.person == 'object'\n ? {\n 'PersonalCode (6028)': 'SSN' in teacher.person ? (teacher.person?.SSN?.value ?? '') : '',\n 'LastName (6003)': 'lastName' in teacher.person ? (teacher.person?.lastName ?? '') : '',\n 'FirstName (6004)': 'firstName' in teacher.person ? (teacher.person?.firstName ?? '') : '',\n 'EMail (6034)': 'emails' in teacher.person ? (teacher.person?.emails?.[0]?.value ?? '') : '',\n }\n : null\n };\n }) ?? [];\n csv += `${papaOptions.newline}Teacher (6000)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (t.length) {\n csv += Papa.unparse(t, papaOptions);\n } else {\n csv += ['Teacher (6001)', 'GUID (5800)', 'Category (6002)', 'PersonalCode (6028)', 'LastName (6003)', 'Title (6006)', 'FirstName (6004)', 'Phone (6033)', 'EMail (6034)', 'EvaluationNumber (6014)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n // append students to csv\n const s = persons?.filter(person => {\n return person.type != 'Teacher';\n }).map(person => {\n return {\n 'Student (7201)': person.SSN?.value,\n 'GUID (5800)': (person.ids && uuid.test(person.ids)) ? `{${person.ids}}` : '',\n 'Category (7305)': '',\n 'LastName (7202)': person.lastName ?? '',\n 'FirstName (7211)': person.firstName ?? '',\n 'EMail (7215)': person.emails?.[0]?.value ?? ''\n };\n }) ?? [];\n csv += `${papaOptions.newline}Student (7200)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (s.length) {\n csv += Papa.unparse(s, papaOptions);\n } else {\n csv += ['Student (7201)', 'GUID (5800)', 'Category (7305)', 'LastName (7202)', 'FirstName (7211)', 'EMail (7215)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n // create a map of students.id to students.SSN\n const studentMap = new Map(persons?.filter(x => x.type != 'Teacher').map(x => [getVertexId(x, options), x.SSN?.value ?? '']));\n\n // append groups to csv\n const g = groups?.map(group => {\n return {\n 'Group (6201)': group.displayName!,\n 'GUID (5800)': (group.ids && uuid.test(group.ids)) ? `{${group.ids}}` : '',\n 'Class (6210)': group.species == 'class' ? 1 : 0,\n 'Teacher (6204)': '',\n 'IClass (6206)': '',\n 'Student (6205)': group.members?.map(x => getVertexId(x, options)).map(x => studentMap.get(x)).filter(Boolean).join(',')\n };\n }) ?? [];\n csv += `${papaOptions.newline}Group (6200)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (g.length) {\n csv += Papa.unparse(g, papaOptions);\n } else {\n csv += ['Group (6201)', 'GUID (5800)', 'Class (6210)', 'Teacher (6204)', 'IClass (6206)', 'Student (6205)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n // append locations to csv\n const l = locations?.map(location => {\n return {\n 'Room (6601)': location.displayName!,\n 'GUID (5800)': (location.ids && uuid.test(location.ids)) ? `{${location.ids}}` : '',\n 'Category (6602)': location.tags?.find(tag => tag.type == 'category')?.value ?? '',\n 'SeatingCapacity (6607)': location.maximumCapacity,\n };\n }) ?? [];\n csv += `${papaOptions.newline}Room (6600)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (l.length) {\n csv += Papa.unparse(l, papaOptions);\n } else {\n csv += ['Room (6601)', 'GUID (5800)', 'Category (6602)', 'SeatingCapacity (6607)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n // append periods to csv\n const p = periods?.map(period => {\n return {\n 'Period (8001)': period.displayName!,\n 'GUID (5800)': (period.ids && uuid.test(period.ids)) ? `{${period.ids}}` : '',\n 'TextBelowSchedule (8002)': period.displayName!,\n 'Category (8006)': '',\n 'Calendar (8005)': period.ranges?.map(range => `${moment.utc(range.start).format('D/M')}-${moment.utc(range.end).format('D/M')}`).join(', ')\n };\n }) ?? [];\n csv += `${papaOptions.newline}Period (8000)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (p.length) {\n csv += Papa.unparse(p, papaOptions);\n } else {\n csv += ['Period (8001)', 'GUID (5800)', 'TextBelowSchedule (8002)', 'Category (8006)', 'Calendar (8005)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n const courseMap = new Map(data.courses ?.map(x => [getVertexId(x, options), x]));\n const periodMap = new Map(data.periods ?.map(x => [getVertexId(x, options), x]));\n const teacherMap = new Map(data.teachers ?.map(x => [getVertexId(x, options), x]));\n const groupMap = new Map(data.groups ?.map(x => [getVertexId(x, options), x]));\n const locationMap = new Map(data.locations ?.map(x => [getVertexId(x, options), x]));\n const syllabusMap = new Map(data.syllabuses?.map(x => [getVertexId(x, options), x]));\n\n // append lessons to csv\n const e = events\n // ?.filter(x => !isNaN(Date.parse(x.start?.toString() ?? '')))\n .map((event, index) => {\n if (!event.start || !event.end) return;\n\n const courseId = event.course ? getVertexId(event.course, options) : undefined;\n const course = courseId ? courseMap.get(courseId) : undefined;\n\n // Only use deserialize period\n let period = event.period == null ? course?.period : event.period;\n if (isString(period))\n period = periodMap.get(period);\n if ((period && !('ranges' in period)))\n period = undefined;\n\n // Only use deserialize teachers\n const t = event.teachers == null ? course?.teachers : event.teachers;\n const teacherIds = t?.map(x => getVertexId(x.to, options));\n const teachers = teacherIds?.map(id => teacherMap.get(id)).filter(Boolean) ?? [];\n\n // Only use deserialize groups\n const g = event.groups == null ? course?.groups : event.groups;\n const groupIds = g?.map(x => getVertexId(x.to, options));\n const groups = groupIds?.map(id => groupMap.get(id)).filter(Boolean) ?? [];\n\n // Only use deserialize locations\n const locationIds = event.inLocations?.map(x => x ? getVertexId(x, options) : null).filter(x => x != null);\n const locations = locationIds?.map(id => locationMap.get(id)).filter(Boolean) ?? [];\n const dayOfWeek = moment.utc(event.start).toDate().toLocaleDateString('sv-SE', { weekday: 'long', timeZone: 'UTC' });\n\n // Syllabus of the course\n const syllabusId = isString(course?.syllabus) ? course.syllabus : (course?.syllabus && isObjectIdOrHexString(course?.syllabus)) ? (course?.syllabus as MongooseTypes.ObjectId | string).toString() : undefined;\n const syllabus = syllabusId ? syllabusMap.get(syllabusId) : course?.syllabus as CoreTypes.Deep.Syllabus | undefined;\n\n // capitalize first letter of dayOfWeek\n const dayOfWeekCapitalized = dayOfWeek.charAt(0).toUpperCase() + dayOfWeek.slice(1);\n return {\n 'PK (7100)': index + 1,\n 'GUID (5800)': (event.ids && uuid.test(event.ids)) ? `{${event.ids}}` : '',\n 'DayOfWeek (7101)': dayOfWeekCapitalized,\n 'Starttime (7102)': moment.utc(event.start).format('HH:mm'),\n 'Length (7115)': event.duration,\n 'Course (7106)': syllabus?.courseCode,\n 'Subject (7103)': syllabus?.subjectCode ?? course?.subject ?? '',\n 'Teacher (7104)': teachers ?.map(x => x?.signature ).filter(Boolean).join(','),\n 'Group (7105)': groups ?.map(x => x?.displayName).filter(Boolean).join(','),\n 'Room (7107)': locations?.map(x => x?.displayName).filter(Boolean).join(','),\n 'Period (7108)': '',\n 'Week (7109)': '',\n 'ActualWeeks (7167)': period?.ranges?.map(range => `${moment.utc(range.start).week()}-${moment.utc(range.end).week()}`).join(',')\n };\n }).filter(Boolean) ?? [];\n csv += `${papaOptions.newline}Lesson (7100)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (e.length) {\n csv += Papa.unparse(e, papaOptions);\n } else {\n csv += ['PK (7100)', 'GUID (5800)', 'DayOfWeek (7101)', 'Starttime (7102)', 'Length (7115)', 'Course (7106)', 'Subject (7103)', 'Period (7108)', 'Week (7109)', 'ActualWeeks (7167)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n // append subjects to csv, is empty for now\n // csv += `Subject (6400)${options.newline}[Rows]${options.newline}`;\n // csv += ['Subject (6401)', 'GUID (5800)', 'Category (6402)', 'FullText (6403)', 'BackgroundColor (6432)', 'TextColor (6433)', 'EvaluationNumber (6429)'].join(options.delimiter);\n // csv += options.newline;\n\n // append syllabus to csv\n const courseSyllabuses = syllabuses?.filter(syllabus => !!syllabus.courseName).map(syllabus => {\n return {\n 'Course (7601)': syllabus.courseCode,\n 'GUID (5800)': syllabus.ids,\n 'FullText (7602)': syllabus.courseName,\n 'Subject (7603)': syllabus.subjectCode ?? '',\n 'Points (7604)': syllabus.points\n };\n }) ?? [];\n csv += `${papaOptions.newline}Course (7600)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (courseSyllabuses.length) {\n csv += Papa.unparse(courseSyllabuses, papaOptions);\n } else {\n csv += ['PK (7100)', 'GUID (5800)', 'DayOfWeek (7101)', 'Starttime (7102)', 'Length (7115)', 'Course (7106)', 'Subject (7103)', 'Period (7108)', 'Week (7109)', 'ActualWeeks (7167)'].join(papaOptions.delimiter);\n }\n csv += papaOptions.newline;\n\n const subjectSyllabuses = syllabuses?.reduce((unique, syllabus) => {\n if (syllabus.subjectCode && !unique.seen.has(syllabus.subjectCode)) {\n unique.seen.add(syllabus.subjectCode);\n unique.result.push({\n 'Subject (6401)': syllabus.subjectCode,\n 'GUID (5800)': syllabus.ids,\n 'FullText (6403)': syllabus.subjectName,\n });\n }\n return unique;\n }, {\n seen: new Set<string>(),\n result: [] as Array<{\n 'Subject (6401)': string;\n 'GUID (5800)': string | undefined;\n 'FullText (6403)': string;\n }>\n })?.result ?? [];\n csv += `Subject (6400)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (subjectSyllabuses.length) {\n csv += Papa.unparse(subjectSyllabuses, papaOptions);\n } else {\n csv += ['Subject (6401)', 'GUID (5800)', 'Category (6402)', 'FullText (6403)', 'BackgroundColor (6432)', 'TextColor (6433)', 'EvaluationNumber (6429)'].join(papaOptions.delimiter);\n }\n\n const totalHoursRegex = /(\\d+) hrs/;\n const weekTimeRegex = /(\\d+) min\\/week/;\n const c = courses?.map(course => {\n // Only use deserialize teachers\n const teacherIds = course.teachers?.map(x => getVertexId(x.to, options)).filter(Boolean);\n const teachers = teacherIds?.map(id => teacherMap.get(id)!).filter(Boolean) ?? [];\n\n // Only use deserialize groups\n const groupIds = course.groups?.map(x => getVertexId(x.to, options)).filter(Boolean);\n const groups = groupIds?.map(id => groupMap.get(id)!).filter(Boolean) ?? [];\n\n // Only use deserialize syllabus\n const syllabusId = isString(course?.syllabus) ? course.syllabus : (course?.syllabus && isObjectIdOrHexString(course?.syllabus)) ? (course?.syllabus as MongooseTypes.ObjectId | string).toString() : undefined;\n const syllabus = syllabusId ? syllabusMap.get(syllabusId) : course?.syllabus as CoreTypes.Deep.Syllabus | undefined;\n\n return {\n 'PK (8200)': '',\n 'GUID (5800)': course.ids,\n 'OriginalRecord (8224)': '1',\n 'CreateLesson (8227)': '1',\n 'Course (8202)': syllabus?.courseCode,\n 'Subject (8209)': syllabus?.subjectCode ?? course.subject, // Nikos ansvarig för framtida buggar\n 'Teacher (8210)': teachers?.map(teacher => teacher.signature).filter(Boolean).join(','),\n 'Group (8203)': groups?.map(group => group.displayName).filter(Boolean).join(','),\n 'TotalHours (8204)': (course.plannedDuration && totalHoursRegex.test(course.plannedDuration)) ? totalHoursRegex.exec(course.plannedDuration)![1] : '',\n 'Weektime (8208)': (course.plannedDuration && weekTimeRegex.test(course.plannedDuration)) ? weekTimeRegex.exec(course.plannedDuration)![1] : '',\n 'Blockname (8215)': '',\n 'Period (8206)': '',\n 'Week (8207)': '',\n 'NotPeriod (8212)': '',\n 'NotWeek (8213)': ''\n };\n }) ?? [];\n csv += `${papaOptions.newline}TA (8200)${papaOptions.newline}[Rows]${papaOptions.newline}`;\n if (c.length) {\n csv += Papa.unparse(c, papaOptions);\n } else {\n csv += ['Course (8202)', 'GUID (5800)', 'Subject (8209)', 'Teacher (8210)', 'Group (8203)', 'TotalHours (8204)', 'Weektime (8208)', 'Blockname (8215)', 'Period (8206)', 'Week (8207)', 'NotPeriod (8212)', 'NotWeek (8213)'].join(papaOptions.delimiter);\n }\n\n return csv;\n};"],"mappings":";;;;;;;AASA,MAAM,cAAc;CAClB,QAAgB;CAChB,WAAgB;CAChB,YAAgB;CAChB,WAAgB;CAChB,QAAgB;CAChB,SAAgB;CAChB,gBAAgB;CAEjB;AAED,MAAM,OAAO;AAEb,yBACE,MACA,UAAuB,EAAE,KACd;CACX,MAAM,EAAE,WAAW,UAAU,QAAQ,SAAS,QAAQ,SAAS,SAAS,YAAY,cAAc;CAClG,MAAM,EAAE,OAAkB,gBAAgB,aAAa;CAEvD,MAAM,YAAa,OAAO,IAAI,MAAM,CAAC,MAAM;CAC3C,MAAM,aAAa,OAAO,IAAI,MAAM,CAAC,OAAO;CAG5C,IAAI,MAAM,WAAW,YAAY,QAAQ,uBAAuB,YAAY,QAAQ,uBAAuB,YAAY,QAAQ,mBAAmB,YAAY,QAAQ,2BAA2B,YAAY,QAAQ,OAAO,YAAY;AACxO,QAAO,cAAc,YAAY,QAAQ,SAAS,cAAc,YAAY,QAAQ,WAAW,YAAY;AAC3G,QAAO,YAAY,YAAY,YAAY,QAAQ,cAAc,YAAY,QAAQ,cAAc,aAAa,YAAY,QAAQ,eAAe,QAAQ,CAAC,OAAO,aAAa,GAAG,YAAY,UAAU,YAAY;AAErN,QAAO,gBAAgB,YAAY,QAAQ,cAAc,YAAY,QAAQ,gBAAgB,YAAY,UAAU,YAAY;AAG/H,QAAO,oBAAoB,YAAY,QAAQ,aAAa,YAAY,QAAQ,aAAa,YAAY,UAAU,YAAY;AAG/H,QAAO,WAAW,YAAY,UAAU,YAAY;CAGpD,MAAM,IAAI,UAAU,KAAI,YAAW;AACjC,SAAO;GACL,kBAA2B,QAAQ;G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AAS,IAAI,GAAG,CAAE,CAAC,OAAO,QAAQ,IAAI,EAAE;EAG/E,MAAM,aAAa,SAAS,QAAQ,SAAS,GAAG,OAAO,WAAY,QAAQ,YAAY,sBAAsB,QAAQ,SAAS,IAAK,QAAQ,UAA6C,UAAU,GAAG;EACrM,MAAM,WAAW,aAAa,YAAY,IAAI,WAAW,GAAG,QAAQ;AAEpE,SAAO;GACL,aAAyB;GACzB,eAAyB,OAAO;GAChC,yBAAyB;GACzB,uBAAyB;GACzB,iBAAyB,UAAU;GACnC,kBAAyB,UAAU,eAAe,OAAO;GACzD,kBAAyBD,YAAU,KAAI,YAAW,QAAQ,UAAU,CAAC,OAAO,QAAQ,CAAC,KAAK,IAAI;GAC9F,gBAAyBC,UAAQ,KAAI,UAAS,MAAM,YAAY,CAAC,OAAO,QAAQ,CAAC,KAAK,IAAI;GAC1F,qBAA0B,OAAO,mBAAmB,gBAAgB,KAAK,OAAO,gBAAgB,GAAI,gBAAgB,KAAK,OAAO,gBAAgB,CAAE,KAAK;GACvJ,mBAA0B,OAAO,mBAAmB,cAAc,KAAK,OAAO,gBAAgB,GAAI,cAAc,KAAK,OAAO,gBAAgB,CAAE,KAAK;GACnJ,oBAAyB;GACzB,iBAAyB;GACzB,eAAyB;GACzB,oBAAyB;GACzB,kBAAyB;GAC1B;GACD,IAAI,EAAE;AACR,QAAO,GAAG,YAAY,QAAQ,WAAW,YAAY,QAAQ,QAAQ,YAAY;AACjF,KAAI,EAAE,OACJ,QAAO,KAAK,QAAQ,GAAG,YAAY;KAEnC,QAAO;EAAC;EAAiB;EAAe;EAAkB;EAAkB;EAAgB;EAAqB;EAAmB;EAAoB;EAAiB;EAAe;EAAoB;EAAiB,CAAC,KAAK,YAAY,UAAU;AAG3P,QAAO"}
@@ -9,9 +9,9 @@ import { PeriodVertex } from "./periods.js";
9
9
  import { BelongsTo } from "./properties/belongs-to.js";
10
10
  import { PersonVertex } from "./persons.js";
11
11
  import { LocationVertex } from "./locations.js";
12
+ import { SyllabusVertex } from "./syllabuses.js";
12
13
  import { EventVertex } from "./events.js";
13
14
  import { OverlapGroupVertex } from "./overlap-groups.js";
14
- import { SyllabusVertex } from "./syllabuses.js";
15
15
  import { ExceptionVertex } from "./exceptions.js";
16
16
  import { GroupVertex } from "./groups.js";
17
17
  import { LockedTimeVertex } from "./locked-times.js";
@@ -10,6 +10,7 @@ import { BelongsTo } from "./properties/belongs-to.js";
10
10
  import { PersonVertex } from "./persons.js";
11
11
  import { LocationVertex } from "./locations.js";
12
12
  import { ThreadVertex } from "./threads.js";
13
+ import { SyllabusVertex } from "./syllabuses.js";
13
14
  import { OverlapGroupVertex } from "./overlap-groups.js";
14
15
  import { CourseVertex } from "./courses.js";
15
16
  import { ExceptionVertex } from "./exceptions.js";
@@ -71,6 +72,7 @@ type ScheduleEventVertex = VertexFactory<'scheduleEvents', EventProperties & {
71
72
  start?: Moment | string;
72
73
  end?: Moment | string;
73
74
  persons?: EdgeWrapper<'array', Plain.Edge<PersonVertex>>;
75
+ syllabus?: EdgeWrapper<'single', Plain.Edge<SyllabusVertex>>;
74
76
  }>;
75
77
  type CalendarEventVertex = VertexFactory<'calendarEvents', BasicSharedProperties & {
76
78
  meta: {
@@ -84,6 +86,7 @@ type CalendarEventVertex = VertexFactory<'calendarEvents', BasicSharedProperties
84
86
  start: number;
85
87
  end: number;
86
88
  exceptions?: EdgeWrapper<'array', Plain.Edge<ExceptionVertex>>;
89
+ syllabus?: EdgeWrapper<'single', Plain.Edge<SyllabusVertex>>;
87
90
  inLocations?: EdgeWrapper<'array', Plain.Edge<LocationVertex> | null>;
88
91
  participants?: EdgeWrapper<'array', Wrapped.Edge<'to', PersonVertex, {
89
92
  groupIndex?: number;
@@ -12,9 +12,9 @@ import { PersonVertex } from "./persons.js";
12
12
  import { LocationVertex } from "./locations.js";
13
13
  import { UserVertex } from "./users.js";
14
14
  import { ThreadVertex } from "./threads.js";
15
+ import { SyllabusVertex } from "./syllabuses.js";
15
16
  import { CalendarEventVertex, EventVertex, ScheduleEventVertex } from "./events.js";
16
17
  import { OverlapGroupVertex } from "./overlap-groups.js";
17
- import { SyllabusVertex } from "./syllabuses.js";
18
18
  import { CourseVertex } from "./courses.js";
19
19
  import { CalendarExceptionAction, ExceptionStatus, ExceptionVertex } from "./exceptions.js";
20
20
  import { GroupVertex } from "./groups.js";
@@ -7,6 +7,8 @@ type SyllabusVertex = VertexFactory<'syllabuses', BelongsTo & {
7
7
  schoolType: string;
8
8
  subjectCode?: string;
9
9
  subjectName: string;
10
+ color?: string | null;
11
+ icon?: string | null;
10
12
  subjectDesignation?: string;
11
13
  courseCode?: string;
12
14
  courseName?: string;
@@ -11,9 +11,9 @@ import { PersonVertex } from "./persons.js";
11
11
  import { LocationVertex } from "./locations.js";
12
12
  import { UserVertex } from "./users.js";
13
13
  import { ThreadVertex } from "./threads.js";
14
+ import { SyllabusVertex } from "./syllabuses.js";
14
15
  import { CalendarEventVertex, EventVertex, ScheduleEventVertex } from "./events.js";
15
16
  import { OverlapGroupVertex } from "./overlap-groups.js";
16
- import { SyllabusVertex } from "./syllabuses.js";
17
17
  import { CourseVertex } from "./courses.js";
18
18
  import { ExceptionVertex } from "./exceptions.js";
19
19
  import { GroupVertex } from "./groups.js";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@royalschedule/maps",
3
3
  "description": "",
4
- "version": "4.0.33",
4
+ "version": "4.0.35",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",