From 7a2e0f20d1c64ab1deb7ab30bfb4bab4daaabd6d Mon Sep 17 00:00:00 2001 From: Rainer Killinger Date: Wed, 10 Nov 2021 11:31:45 +0100 Subject: [PATCH] feat: add SCAssessment --- src/meta.ts | 125 +++++++------- src/things/abstract/academic-degree.ts | 42 +---- src/things/abstract/thing.ts | 3 +- src/things/assessment.ts | 162 ++++++++++++++++++ ...ourse-of-studies.ts => course-of-study.ts} | 86 +++++----- src/translator.ts | 2 +- test/resources/indexable/Assessment.1.json | 36 ++++ test/resources/indexable/Assessment.2.json | 51 ++++++ ...eOfStudies.1.json => CourseOfStudy.1.json} | 7 +- test/type.spec.ts | 30 +++- 10 files changed, 390 insertions(+), 154 deletions(-) create mode 100644 src/things/assessment.ts rename src/things/{course-of-studies.ts => course-of-study.ts} (63%) create mode 100644 test/resources/indexable/Assessment.1.json create mode 100644 test/resources/indexable/Assessment.2.json rename test/resources/indexable/{CourseOfStudies.1.json => CourseOfStudy.1.json} (85%) diff --git a/src/meta.ts b/src/meta.ts index 28567046..498fe7ad 100644 --- a/src/meta.ts +++ b/src/meta.ts @@ -15,11 +15,12 @@ import {SCThingType} from './things/abstract/thing'; import {SCAcademicEvent, SCAcademicEventMeta, SCAcademicEventWithoutReferences} from './things/academic-event'; import {SCArticle, SCArticleMeta, SCArticleWithoutReferences} from './things/article'; +import {SCAssessment, SCAssessmentMeta, SCAssessmentWithoutReferences} from './things/assessment'; import {SCBook, SCBookMeta, SCBookWithoutReferences} from './things/book'; import {SCBuilding, SCBuildingMeta, SCBuildingWithoutReferences} from './things/building'; import {SCCatalog, SCCatalogMeta, SCCatalogWithoutReferences} from './things/catalog'; import {SCContactPoint, SCContactPointMeta, SCContactPointWithoutReferences} from './things/contact-point'; -import {SCCourseOfStudies, SCCourseOfStudiesMeta, SCCourseOfStudiesWithoutReferences} from './things/course-of-studies'; +import {SCCourseOfStudy, SCCourseOfStudyMeta, SCCourseOfStudyWithoutReferences} from './things/course-of-study'; import {SCDateSeries, SCDateSeriesMeta, SCDateSeriesWithoutReferences} from './things/date-series'; import {SCDiff, SCDiffMeta, SCDiffWithoutReferences} from './things/diff'; import {SCDish, SCDishMeta, SCDishWithoutReferences} from './things/dish'; @@ -51,13 +52,14 @@ import {SCVideo, SCVideoMeta, SCVideoWithoutReferences} from './things/video'; */ export const SCClasses: { [K in SCThingType]: object } = { /* tslint:enable */ + 'assessment': SCAssessmentMeta, 'academic event': SCAcademicEventMeta, 'article': SCArticleMeta, 'book': SCBookMeta, 'building': SCBuildingMeta, 'catalog': SCCatalogMeta, 'contact point': SCContactPointMeta, - 'course of studies': SCCourseOfStudiesMeta, + 'course of study': SCCourseOfStudyMeta, 'date series': SCDateSeriesMeta, 'diff': SCDiffMeta, 'dish': SCDishMeta, @@ -81,13 +83,14 @@ export const SCClasses: { [K in SCThingType]: object } = { }; export type SCIndexableThings = - SCAcademicEvent + SCAssessment + | SCAcademicEvent | SCArticle | SCBook | SCBuilding | SCCatalog | SCContactPoint - | SCCourseOfStudies + | SCCourseOfStudy | SCDateSeries | SCDish | SCFloor @@ -122,64 +125,66 @@ export type SCThingsField = keyof SCThings | string; * Thing without references for a thing */ export type SCAssociatedThingWithoutReferences = - THING extends SCAcademicEvent ? SCAcademicEventWithoutReferences : - THING extends SCArticle ? SCArticleWithoutReferences : - THING extends SCBook ? SCBookWithoutReferences : - THING extends SCBuilding ? SCBuildingWithoutReferences : - THING extends SCCatalog ? SCCatalogWithoutReferences : - THING extends SCContactPoint ? SCContactPointWithoutReferences : - THING extends SCCourseOfStudies ? SCCourseOfStudiesWithoutReferences : - THING extends SCDateSeries ? SCDateSeriesWithoutReferences : - THING extends SCDiff ? SCDiffWithoutReferences : - THING extends SCDish ? SCDishWithoutReferences : - THING extends SCFavorite ? SCFavoriteWithoutReferences : - THING extends SCFloor ? SCFloorWithoutReferences : - THING extends SCMessage ? SCMessageWithoutReferences : - THING extends SCOrganization ? SCOrganizationWithoutReferences : - THING extends SCPeriodical ? SCPeriodicalWithoutReferences : - THING extends SCPerson ? SCPersonWithoutReferences : - THING extends SCPointOfInterest ? SCPointOfInterestWithoutReferences : - THING extends SCPublicationEvent ? SCPublicationEventWithoutReferences : - THING extends SCRoom ? SCRoomWithoutReferences : - THING extends SCSemester ? SCSemesterWithoutReferences : - THING extends SCSetting ? SCSettingWithoutReferences : - THING extends SCSportCourse ? SCSportCourseWithoutReferences : - THING extends SCStudyModule ? SCStudyModuleWithoutReferences : - THING extends SCTicket ? SCTicketWithoutReferences : - THING extends SCToDo ? SCToDoWithoutReferences : - THING extends SCTour ? SCTourWithoutReferences : - THING extends SCVideo ? SCVideoWithoutReferences : - never; + THING extends SCAssessment ? SCAssessmentWithoutReferences : + THING extends SCAcademicEvent ? SCAcademicEventWithoutReferences : + THING extends SCArticle ? SCArticleWithoutReferences : + THING extends SCBook ? SCBookWithoutReferences : + THING extends SCBuilding ? SCBuildingWithoutReferences : + THING extends SCCatalog ? SCCatalogWithoutReferences : + THING extends SCContactPoint ? SCContactPointWithoutReferences : + THING extends SCCourseOfStudy ? SCCourseOfStudyWithoutReferences : + THING extends SCDateSeries ? SCDateSeriesWithoutReferences : + THING extends SCDiff ? SCDiffWithoutReferences : + THING extends SCDish ? SCDishWithoutReferences : + THING extends SCFavorite ? SCFavoriteWithoutReferences : + THING extends SCFloor ? SCFloorWithoutReferences : + THING extends SCMessage ? SCMessageWithoutReferences : + THING extends SCOrganization ? SCOrganizationWithoutReferences : + THING extends SCPeriodical ? SCPeriodicalWithoutReferences : + THING extends SCPerson ? SCPersonWithoutReferences : + THING extends SCPointOfInterest ? SCPointOfInterestWithoutReferences : + THING extends SCPublicationEvent ? SCPublicationEventWithoutReferences : + THING extends SCRoom ? SCRoomWithoutReferences : + THING extends SCSemester ? SCSemesterWithoutReferences : + THING extends SCSetting ? SCSettingWithoutReferences : + THING extends SCSportCourse ? SCSportCourseWithoutReferences : + THING extends SCStudyModule ? SCStudyModuleWithoutReferences : + THING extends SCTicket ? SCTicketWithoutReferences : + THING extends SCToDo ? SCToDoWithoutReferences : + THING extends SCTour ? SCTourWithoutReferences : + THING extends SCVideo ? SCVideoWithoutReferences : + never; /** * Thing for a thing without references */ export type SCAssociatedThing = - THING extends SCAcademicEventWithoutReferences ? SCAcademicEvent : - THING extends SCArticleWithoutReferences ? SCArticle : - THING extends SCBookWithoutReferences ? SCBook : - THING extends SCBuildingWithoutReferences ? SCBuilding : - THING extends SCCatalogWithoutReferences ? SCCatalog : - THING extends SCContactPointWithoutReferences ? SCContactPoint : - THING extends SCCourseOfStudiesWithoutReferences ? SCCourseOfStudies : - THING extends SCDateSeriesWithoutReferences ? SCDateSeries : - THING extends SCDiffWithoutReferences ? SCDiff : - THING extends SCDishWithoutReferences ? SCDish : - THING extends SCFavoriteWithoutReferences ? SCFavorite : - THING extends SCFloorWithoutReferences ? SCFloor : - THING extends SCMessageWithoutReferences ? SCMessage : - THING extends SCOrganizationWithoutReferences ? SCOrganization : - THING extends SCPeriodicalWithoutReferences ? SCPeriodical : - THING extends SCPersonWithoutReferences ? SCPerson : - THING extends SCPointOfInterestWithoutReferences ? SCPointOfInterest : - THING extends SCPublicationEventWithoutReferences ? SCPublicationEvent : - THING extends SCRoomWithoutReferences ? SCRoom : - THING extends SCSemesterWithoutReferences ? SCSemester : - THING extends SCSettingWithoutReferences ? SCSetting : - THING extends SCSportCourseWithoutReferences ? SCSportCourse : - THING extends SCStudyModuleWithoutReferences ? SCStudyModule : - THING extends SCTicketWithoutReferences ? SCTicket : - THING extends SCToDoWithoutReferences ? SCToDo : - THING extends SCTourWithoutReferences ? SCTour : - THING extends SCVideoWithoutReferences ? SCVideo : - never; + THING extends SCAssessmentWithoutReferences ? SCAssessment : + THING extends SCAcademicEventWithoutReferences ? SCAcademicEvent : + THING extends SCArticleWithoutReferences ? SCArticle : + THING extends SCBookWithoutReferences ? SCBook : + THING extends SCBuildingWithoutReferences ? SCBuilding : + THING extends SCCatalogWithoutReferences ? SCCatalog : + THING extends SCContactPointWithoutReferences ? SCContactPoint : + THING extends SCCourseOfStudyWithoutReferences ? SCCourseOfStudy : + THING extends SCDateSeriesWithoutReferences ? SCDateSeries : + THING extends SCDiffWithoutReferences ? SCDiff : + THING extends SCDishWithoutReferences ? SCDish : + THING extends SCFavoriteWithoutReferences ? SCFavorite : + THING extends SCFloorWithoutReferences ? SCFloor : + THING extends SCMessageWithoutReferences ? SCMessage : + THING extends SCOrganizationWithoutReferences ? SCOrganization : + THING extends SCPeriodicalWithoutReferences ? SCPeriodical : + THING extends SCPersonWithoutReferences ? SCPerson : + THING extends SCPointOfInterestWithoutReferences ? SCPointOfInterest : + THING extends SCPublicationEventWithoutReferences ? SCPublicationEvent : + THING extends SCRoomWithoutReferences ? SCRoom : + THING extends SCSemesterWithoutReferences ? SCSemester : + THING extends SCSettingWithoutReferences ? SCSetting : + THING extends SCSportCourseWithoutReferences ? SCSportCourse : + THING extends SCStudyModuleWithoutReferences ? SCStudyModule : + THING extends SCTicketWithoutReferences ? SCTicket : + THING extends SCToDoWithoutReferences ? SCToDo : + THING extends SCTourWithoutReferences ? SCTour : + THING extends SCVideoWithoutReferences ? SCVideo : + never; diff --git a/src/things/abstract/academic-degree.ts b/src/things/abstract/academic-degree.ts index 1623cb69..d7f7fa96 100644 --- a/src/things/abstract/academic-degree.ts +++ b/src/things/abstract/academic-degree.ts @@ -22,26 +22,25 @@ export interface SCAcademicDegreeWithoutReferences extends SCThingWithoutReferences { /** * The achievable academic degree + * + * @filterable + * @sortable ducet */ - academicDegree: SCGermanAcademicDegree; + academicDegree: string; /** * The achievable academic degree with academic field specification * (eg. Master of Science) * - * @filterable - * @keyword */ - academicDegreewithField: string; + academicDegreewithField?: string; /** * The achievable academic degree with academic field specification * shorted (eg. M.Sc.). * - * @filterable - * @keyword */ - academicDegreewithFieldShort: string; + academicDegreewithFieldShort?: string; } /** @@ -63,9 +62,9 @@ export class SCAcademicDegreeMeta fieldTranslations = { de: { ...SCThingMeta.getInstance().fieldTranslations.de, - academicDegree: 'Hochschulgrad', - academicDegreewithField: 'Abschlussbezeichnungen', - academicDegreewithFieldShort: 'Abschlussbezeichnungen (kurz)', + academicDegree: 'Abschlussgrad', + academicDegreewithField: 'Abschlussbezeichnung', + academicDegreewithFieldShort: 'Abschlussbezeichnung (kurz)', }, en: { ...SCThingMeta.getInstance().fieldTranslations.en, @@ -81,32 +80,9 @@ export class SCAcademicDegreeMeta fieldValueTranslations = { de: { ...SCThingMeta.getInstance().fieldValueTranslations.de, - academicDegree: { - 'bachelor': 'Bachelor', - 'diploma': 'Diplom', - 'doctor': 'Doktor', - 'licentiate': 'Lizenziat', - 'magister': 'Magister', - 'master': 'Master', - 'masterstudent': 'Meisterschüler', - 'state examination': 'Staatsexamen', - }, }, en: { ...SCThingMeta.getInstance().fieldValueTranslations.en, }, }; } - -/** - * Types of (german) academic degrees - */ -export type SCGermanAcademicDegree = - 'bachelor' - | 'diploma' - | 'doctor' - | 'licentiate' - | 'magister' - | 'master' - | 'master pupil' - | 'state examination' ; diff --git a/src/things/abstract/thing.ts b/src/things/abstract/thing.ts index fb0b427b..b9d502ef 100644 --- a/src/things/abstract/thing.ts +++ b/src/things/abstract/thing.ts @@ -23,6 +23,7 @@ import {SCPersonWithoutReferences} from '../person'; * Types a thing can be */ export enum SCThingType { + Assessment = 'assessment', AcademicEvent = 'academic event', Article = 'article', Book = 'book', @@ -30,7 +31,7 @@ export enum SCThingType { Building = 'building', Catalog = 'catalog', ContactPoint = 'contact point', - CourseOfStudies = 'course of studies', + CourseOfStudy = 'course of study', DateSeries = 'date series', Diff = 'diff', Dish = 'dish', diff --git a/src/things/assessment.ts b/src/things/assessment.ts new file mode 100644 index 00000000..7724ec93 --- /dev/null +++ b/src/things/assessment.ts @@ -0,0 +1,162 @@ +/* + * Copyright (C) 2019-2021 StApps + * This program is free software: you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation, version 3. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +import {SCMetaTranslations, SCTranslations} from '../general/i18n'; +import {SCISO8601Date} from '../general/time'; +import {SCThing, SCThingMeta, SCThingType} from './abstract/thing'; +import {SCThingWithCategories, SCThingWithCategoriesSpecificValues, SCThingWithCategoriesTranslatableProperties, SCThingWithCategoriesWithoutReferences, SCThingWithCategoriesWithoutReferencesMeta} from './abstract/thing-with-categories'; +import {SCCourseOfStudyWithoutReferences} from './course-of-study'; + + +/** + * Categories of assessments + */ + export type SCAssessmentCategories = 'university assessment'; + +/** + * An assessment without references + * + */ +export interface SCAssessmentWithoutReferences + extends SCThingWithCategoriesWithoutReferences { + /** + * Number of attempts + * + * @integer + */ + attempt?: number; + + /** + * Date assessment was taken or graded + */ + date?: SCISO8601Date; + + /** + * ECTS (credit-points) + * + * @float + */ + ects?: number; + + /** + * Grade + */ + grade: string; + + /** + * Current status + */ + status?: string; + + /** + * Translated fields of an assessment + */ + translations?: SCTranslations; + + /** + * Type of an assessment + */ + type: SCThingType.Assessment; +} + +/** + * An assessment + * + * @validatable + */ +export interface SCAssessment + extends SCAssessmentWithoutReferences, SCThing, + SCThingWithCategories { + + /** + * Course of study the assessment was taken for + */ + courseOfStudy?: SCCourseOfStudyWithoutReferences; + + /** + * An array of assessments from the 'level 0' (root) assessment to the direct parent + */ + superAssessments?: SCAssessmentWithoutReferences[]; + + /** + * Translated fields of an assessment + */ + translations?: SCTranslations; + + /** + * Type of an assessment + */ + type: SCThingType.Assessment; + +} + +export interface SCAssessmentTranslatableProperties + extends SCThingWithCategoriesTranslatableProperties { + /** + * @see SCAssessmentWithoutReferences.status + */ + status?: string; +} + +/** + * Study module meta data + */ + export class SCAssessmentMeta + extends SCThingMeta + implements SCMetaTranslations { + /** + * Translations of fields + */ + fieldTranslations = { + de: { + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldTranslations.de, + attempt: 'Versuch', + courseOfStudy: 'Studiengang', + date: 'Datum', + ects: 'ECTS-Punkte', + grade: 'Note', + status: 'Status', + superAssessments: 'übergeordnete Prüfungen', + }, + en: { + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldTranslations.en, + attempt: 'attempt', + courseOfStudy: 'course of study', + date: 'date', + ects: 'ECTS points', + grade: 'grade', + status: 'status', + superAssessments: 'parent assessments', + }, + }; + + /** + * Translations of values of fields + */ + fieldValueTranslations = { + de: { + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldValueTranslations.de, + type: 'Prüfung', + }, + en: { + ...SCThingWithCategoriesWithoutReferencesMeta.getInstance().fieldValueTranslations.en, + type: SCThingType.Assessment, + }, + }; +} diff --git a/src/things/course-of-studies.ts b/src/things/course-of-study.ts similarity index 63% rename from src/things/course-of-studies.ts rename to src/things/course-of-study.ts index 718d7c4c..f1fbe6d6 100644 --- a/src/things/course-of-studies.ts +++ b/src/things/course-of-study.ts @@ -26,94 +26,90 @@ import {SCDateSeriesWithoutReferences} from './date-series'; import {SCOrganizationWithoutReferences} from './organization'; /** - * A course of studies without references + * A course of study without references */ -export interface SCCourseOfStudiesWithoutReferences +export interface SCCourseOfStudyWithoutReferences extends SCAcademicDegreeWithoutReferences, SCThingThatCanBeOfferedWithoutReferences { /** - * The main language in which the course of studies + * The main language in which the course of study * is beeing offered */ - mainLanguage: SCLanguage; + mainLanguage?: SCLanguage; /** - * Actual major of the course of studies (eg. physics) + * The modes the course of study is offered in * * @filterable - * @keyword */ - major: string; + mode?: SCCourseOfStudyMode; /** - * The modes the course of studies is offered in + * The time modes the course of study is offered in + * + * @filterable */ - mode: SCCourseOfStudiesMode; - - /** - * The time modes the course of studies is offered in - */ - timeMode: SCCourseOfStudiesTimeMode; + timeMode?: SCCourseOfStudyTimeMode; /** * Translated fields of a dish */ - translations?: SCTranslations; + translations?: SCTranslations; /** - * Type of the course of studies + * Type of the course of study */ - type: SCThingType.CourseOfStudies; + type: SCThingType.CourseOfStudy; } /** - * A course of studies + * A course of study * * @validatable * @indexable */ -export interface SCCourseOfStudies - extends SCCourseOfStudiesWithoutReferences, SCThingThatCanBeOffered, SCAcademicDegree { +export interface SCCourseOfStudy + extends SCCourseOfStudyWithoutReferences, SCThingThatCanBeOffered, SCAcademicDegree { /** - * The department that manages the course of studies + * The department that manages the course of study */ - department: SCOrganizationWithoutReferences; + department?: SCOrganizationWithoutReferences; /** * The secretary that administers requests and - * questions concerning the course of studies + * questions concerning the course of study */ - secretary: SCOrganizationWithoutReferences; + secretary?: SCOrganizationWithoutReferences; /** - * Dates at which the course of studies is planned to start + * Dates at which the course of study is planned to start */ startDates?: SCDateSeriesWithoutReferences[]; /** - * Translated fields of a course of studies + * Translated fields of a course of study */ - translations?: SCTranslations; + translations?: SCTranslations; /** - * Type of the course of studies + * Type of the course of study */ - type: SCThingType.CourseOfStudies; + type: SCThingType.CourseOfStudy; } /** - * Translatable properties of a course of studies + * Translatable properties of a course of study */ -export interface SCCourseOfStudiesTranslatableProperties +export interface SCCourseOfStudyTranslatableProperties extends SCThingThatCanBeOfferedTranslatableProperties { - // noop + // noop } /** - * Meta information about a course of studies + * Meta information about a course of study */ -export class SCCourseOfStudiesMeta +export class SCCourseOfStudyMeta extends SCThingMeta - implements SCMetaTranslations { + implements SCMetaTranslations { /** * Translations of fields */ @@ -125,7 +121,6 @@ export class SCCourseOfStudiesMeta .fieldTranslations.de, department: 'Fachbereich', mainLanguage: 'Unterrichtssprache', - major: 'Studienfach', mode: 'Studiengangsart', secretary: 'Sekretariat', startDates: 'Startdatum', @@ -138,7 +133,6 @@ export class SCCourseOfStudiesMeta .fieldTranslations.de, department: 'department', mainLanguage: 'main language', - major: 'major', mode: 'mode', secretary: 'secretary', startDates: 'start dates', @@ -167,30 +161,30 @@ export class SCCourseOfStudiesMeta en: { ...SCAcademicDegreeMeta.getInstance().fieldValueTranslations.en, modes: { - combination: 'combination course of studies', - 'double-degree': 'double degree course of studies', - dual: 'dual course of studies', - standard: 'course of studies', + combination: 'combination course of study', + 'double-degree': 'double degree course of study', + dual: 'dual course of study', + standard: 'course of study', }, timeMode: { fulltime: 'full-time', parttime: 'part-time', }, - type: SCThingType.CourseOfStudies, + type: SCThingType.CourseOfStudy, }, }; } /** - * Types of (german) course of studies modes + * Types of (german) course of study modes */ -export type SCCourseOfStudiesMode = 'combination' +export type SCCourseOfStudyMode = 'combination' | 'dual' | 'double-degree' | 'standard' ; /** - * Types of (german) course of studies time modes + * Types of (german) course of study time modes */ -export type SCCourseOfStudiesTimeMode = 'fulltime' +export type SCCourseOfStudyTimeMode = 'fulltime' | 'parttime' ; diff --git a/src/translator.ts b/src/translator.ts index 92ba540a..cd14d3c2 100644 --- a/src/translator.ts +++ b/src/translator.ts @@ -281,7 +281,7 @@ export class SCThingTranslator { * Given a SCThingType this function returns an object with the same basic structure as the corresponding SCThing * All the values will be set to the known translations of the property/key name * @example - * const translatedMetaDish = translator.translatedPropertyNames(SCThingType.CourseOfStudies); + * const translatedMetaDish = translator.translatedPropertyNames(SCThingType.CourseOfStudy); * @param type The type whose property names will be translated * @returns An object with the properties of the SCThingType where the values are the known property tranlations */ diff --git a/test/resources/indexable/Assessment.1.json b/test/resources/indexable/Assessment.1.json new file mode 100644 index 00000000..922ab056 --- /dev/null +++ b/test/resources/indexable/Assessment.1.json @@ -0,0 +1,36 @@ +{ + "errorNames": [], + "instance": { + "attempt": 1, + "date": "2020-04-01", + "ects": 20, + "grade": "N/A", + "status": "ongoing", + "uid": "681a59a1-23c2-5d78-861a-8c86a3abf404", + "name": "Introductory courses extreme math", + "categories": [ + "university assessment" + ], + "courseOfStudy": { + "academicDegree": "bachelor", + "academicDegreewithField": "Bachelor of Arts", + "academicDegreewithFieldShort": "B.A.", + "mainLanguage": { + "code": "de", + "name": "german" + }, + "mode": "dual", + "name": "Astroturfing", + "timeMode": "parttime", + "type": "course of study", + "uid": "4c6f0a18-343d-5175-9fb1-62d28545c2aa" + }, + "origin": { + "indexed": "2020-04-11T12:30:00Z", + "name": "Dummy", + "type": "remote" + }, + "type": "assessment" + }, + "schema": "SCAssessment" +} diff --git a/test/resources/indexable/Assessment.2.json b/test/resources/indexable/Assessment.2.json new file mode 100644 index 00000000..2945699f --- /dev/null +++ b/test/resources/indexable/Assessment.2.json @@ -0,0 +1,51 @@ +{ + "errorNames": [], + "instance": { + "attempt": 1, + "date": "2020-04-01", + "ects": 6, + "grade": "very much 1.0", + "status": "passed", + "uid": "681a59a1-23c2-5d78-861a-8c86a3abf303", + "name": "Mathe 9001", + "categories": [ + "university assessment" + ], + "superAssessments": [ + { + "attempt": 1, + "date": "2020-04-01", + "ects": 20, + "grade": "N/A", + "status": "ongoing", + "uid": "681a59a1-23c2-5d78-861a-8c86a3abf404", + "name": "Introductory courses extreme math", + "categories": [ + "university assessment" + ], + "type": "assessment" + } + ], + "courseOfStudy": { + "academicDegree": "bachelor", + "academicDegreewithField": "Bachelor of Arts", + "academicDegreewithFieldShort": "B.A.", + "mainLanguage": { + "code": "de", + "name": "german" + }, + "mode": "dual", + "name": "Astroturfing", + "timeMode": "parttime", + "type": "course of study", + "uid": "4c6f0a18-343d-5175-9fb1-62d28545c2aa" + }, + "origin": { + "indexed": "2020-04-11T12:30:00Z", + "name": "Dummy", + "type": "remote" + }, + "type": "assessment" + }, + "schema": "SCAssessment" +} diff --git a/test/resources/indexable/CourseOfStudies.1.json b/test/resources/indexable/CourseOfStudy.1.json similarity index 85% rename from test/resources/indexable/CourseOfStudies.1.json rename to test/resources/indexable/CourseOfStudy.1.json index 9976c1b6..ac0b2552 100644 --- a/test/resources/indexable/CourseOfStudies.1.json +++ b/test/resources/indexable/CourseOfStudy.1.json @@ -13,9 +13,8 @@ "code": "de", "name": "german" }, - "major": "Astroturfing", "mode": "dual", - "name": "Astroturfing Bachelor", + "name": "Astroturfing", "origin": { "indexed": "2018-09-11T12:30:00Z", "name": "Dummy", @@ -27,8 +26,8 @@ "uid": "b0f878fd-8fda-53b8-b065-a8d854c3d0d2" }, "timeMode": "parttime", - "type": "course of studies", + "type": "course of study", "uid": "4c6f0a18-343d-5175-9fb1-62d28545c2aa" }, - "schema": "SCCourseOfStudies" + "schema": "SCCourseOfStudy" } diff --git a/test/type.spec.ts b/test/type.spec.ts index 9fac9ccc..459f2647 100644 --- a/test/type.spec.ts +++ b/test/type.spec.ts @@ -16,11 +16,12 @@ import {assert, Has, IsAny, IsNever, NotHas} from 'conditional-type-checks'; import {SCThing, SCThingWithoutReferences} from '../src/things/abstract/thing'; import {SCAcademicEvent, SCAcademicEventWithoutReferences} from '../src/things/academic-event'; import {SCArticle, SCArticleWithoutReferences} from '../src/things/article'; +import {SCAssessment, SCAssessmentWithoutReferences} from '../src/things/assessment'; import {SCBook, SCBookWithoutReferences} from '../src/things/book'; import {SCBuilding, SCBuildingWithoutReferences} from '../src/things/building'; import {SCCatalog, SCCatalogWithoutReferences} from '../src/things/catalog'; import {SCContactPoint, SCContactPointWithoutReferences} from '../src/things/contact-point'; -import {SCCourseOfStudies, SCCourseOfStudiesWithoutReferences} from '../src/things/course-of-studies'; +import {SCCourseOfStudy, SCCourseOfStudyWithoutReferences} from '../src/things/course-of-study'; import {SCDateSeries, SCDateSeriesWithoutReferences} from '../src/things/date-series'; import {SCDiff, SCDiffWithoutReferences} from '../src/things/diff'; import {SCDish, SCDishWithoutReferences} from '../src/things/dish'; @@ -107,6 +108,17 @@ assert>(false); assert>(false); assert>(true); +/** + * Types of properties of SCAssessment + */ + type SCAssessmentPropertyTypes = PropertyTypesNested; + assert>(false); + assert>(true); + assert>(true); + assert>(false); + assert>(false); + assert>(true); + /** * Types of properties of SCBook */ @@ -152,15 +164,15 @@ assert>(false); assert>(true); /** - * Types of properties of SCCourseOfStudies + * Types of properties of SCCourseOfStudy */ -type SCCourseOfStudiesPropertyTypes = PropertyTypesNested; -assert>(false); -assert>(true); -assert>(true); -assert>(false); -assert>(false); -assert>(true); +type SCCourseOfStudyPropertyTypes = PropertyTypesNested; +assert>(false); +assert>(true); +assert>(true); +assert>(false); +assert>(false); +assert>(true); /** * Types of properties of SCDateSeries