diff --git a/services/backend/tests/api/courses/courseYearlyStats/attemptStatistics/mat11001.test.ts b/services/backend/tests/api/courses/courseYearlyStats/attemptStatistics/mat11001.test.ts index 46ff09817..08f6093f0 100644 --- a/services/backend/tests/api/courses/courseYearlyStats/attemptStatistics/mat11001.test.ts +++ b/services/backend/tests/api/courses/courseYearlyStats/attemptStatistics/mat11001.test.ts @@ -4,12 +4,12 @@ import { describe, it, beforeAll, assert } from 'vitest' import { initTests } from '../../../../utils' import { getCourseYearlyStats, CourseYearlyStats } from '../helpers' -void describe('Course yearly attempt statistics - MAT11001 (no substitutions)', () => { +void describe('Course yearly attempt statistics - MAT11001 (hy-CU-117375151, no substitutions)', () => { let app: Express let body: CourseYearlyStats beforeAll(async () => { app = await initTests() - body = await getCourseYearlyStats(app, 'codes=MAT11001&combineSubstitutions=false') + body = await getCourseYearlyStats(app, 'courses=hy-CU-117375151&substitutions=false') }) it('should include every attempt of a student who has only failed the course', () => { diff --git a/services/backend/tests/api/courses/courseYearlyStats/attemptStatistics/mat11002.test.ts b/services/backend/tests/api/courses/courseYearlyStats/attemptStatistics/mat11002.test.ts index b97d01c5a..5eb40a238 100644 --- a/services/backend/tests/api/courses/courseYearlyStats/attemptStatistics/mat11002.test.ts +++ b/services/backend/tests/api/courses/courseYearlyStats/attemptStatistics/mat11002.test.ts @@ -4,12 +4,12 @@ import { describe, it, beforeAll, assert } from 'vitest' import { initTests } from '../../../../utils' import { getCourseYearlyStats, CourseYearlyStats } from '../helpers' -void describe('Course yearly attempt statistics - MAT11002 (no substitutions)', () => { +void describe('Course yearly attempt statistics - MAT11002 (hy-CU-117375394, no substitutions)', () => { let app: Express let body: CourseYearlyStats beforeAll(async () => { app = await initTests() - body = await getCourseYearlyStats(app, 'codes=MAT11002&combineSubstitutions=false') + body = await getCourseYearlyStats(app, 'courses=hy-CU-117375394&substitutions=false') }) // FIXME: What is this even testing?? diff --git a/services/backend/tests/api/courses/courseYearlyStats/attemptStatistics/mat21003.test.ts b/services/backend/tests/api/courses/courseYearlyStats/attemptStatistics/mat21003.test.ts index 54f3f1354..08d2e32e5 100644 --- a/services/backend/tests/api/courses/courseYearlyStats/attemptStatistics/mat21003.test.ts +++ b/services/backend/tests/api/courses/courseYearlyStats/attemptStatistics/mat21003.test.ts @@ -5,7 +5,11 @@ import { yearToYearCode } from '@oodikone/shared/util' import { initTests } from '../../../../utils' import { getCourseYearlyStats, CourseYearlyStats } from '../helpers' -void describe('Course yearly attempt statistics - MAT21003 (no substitutions)', () => { +const courseCodeToGroupId = { + MAT21003: 'hy-CU-117375829', +} + +void describe('Course yearly attempt statistics - MAT21003 (hy-CU-117375394, no substitutions)', () => { let app: Express beforeAll(async () => { app = await initTests() @@ -14,7 +18,7 @@ void describe('Course yearly attempt statistics - MAT21003 (no substitutions)', describe('duplicate failed attempts across a large timespan are counted separately', () => { let body: CourseYearlyStats beforeAll(async () => { - body = await getCourseYearlyStats(app, 'codes=MAT21003&combineSubstitutions=false') + body = await getCourseYearlyStats(app, `courses=${courseCodeToGroupId.MAT21003}&substitutions=false`) }) it('2017-2018 should include a single failed attempt (539036)', () => { @@ -42,7 +46,7 @@ void describe('Course yearly attempt statistics - MAT21003 (no substitutions)', ])('should include correct years for %s', async (name, from, to) => { const body = await getCourseYearlyStats( app, - `codes=MAT21003&combineSubstitutions=false&fromYearCode=${yearToYearCode(from)}&toYearCode=${yearToYearCode(to)}` + `courses=hy-CU-117375394&substitutions=false&fromYearCode=${yearToYearCode(from)}&toYearCode=${yearToYearCode(to)}` ) const years: string[] = [] @@ -50,7 +54,7 @@ void describe('Course yearly attempt statistics - MAT21003 (no substitutions)', years.push(`${i}-${i + 1}`) } assert.deepStrictEqual( - body.unifyStats!.statistics.map(({ name }) => name), + body.unifyStats.statistics.map(({ name }) => name), years, `${name} included incorrect years` ) @@ -61,9 +65,9 @@ void describe('Course yearly attempt statistics - MAT21003 (no substitutions)', it('2017-2018 should include a failed attempt (539036)', async () => { const body = await getCourseYearlyStats( app, - `codes=MAT21003&combineSubstitutions=false&fromYearCode=${yearToYearCode(2017)}&toYearCode=${yearToYearCode(2017)}` + `courses=${courseCodeToGroupId.MAT21003}&substitutions=false&fromYearCode=${yearToYearCode(2017)}&toYearCode=${yearToYearCode(2017)}` ) - const year = body.unifyStats!.statistics.find(year => year.name === '2017-2018') + const year = body.unifyStats.statistics.find(year => year.name === '2017-2018') assert(year && 'enrollments' in year, 'Missing stats for 2017-2018') assert.deepStrictEqual( year.attempts.categories.failed, @@ -75,9 +79,9 @@ void describe('Course yearly attempt statistics - MAT21003 (no substitutions)', it('2018-2019 should include a failed attempt (539036)', async () => { const body = await getCourseYearlyStats( app, - `codes=MAT21003&combineSubstitutions=false&fromYearCode=${yearToYearCode(2018)}&toYearCode=${yearToYearCode(2018)}` + `courses=${courseCodeToGroupId.MAT21003}&substitutions=false&fromYearCode=${yearToYearCode(2018)}&toYearCode=${yearToYearCode(2018)}` ) - const year = body.unifyStats?.statistics.find(year => year.name === '2018-2019') + const year = body.unifyStats.statistics.find(year => year.name === '2018-2019') assert(year && 'enrollments' in year, 'Missing stats for 2018-2019') assert.include(year.attempts.categories.failed, '539036', 'Failed attempts included the incorrect students') }) diff --git a/services/backend/tests/api/courses/courseYearlyStats/attemptStatistics/tkt10002.test.ts b/services/backend/tests/api/courses/courseYearlyStats/attemptStatistics/tkt10002.test.ts index 828749bca..400ac7089 100644 --- a/services/backend/tests/api/courses/courseYearlyStats/attemptStatistics/tkt10002.test.ts +++ b/services/backend/tests/api/courses/courseYearlyStats/attemptStatistics/tkt10002.test.ts @@ -5,7 +5,7 @@ import { yearToYearCode } from '@oodikone/shared/util' import { initTests } from '../../../../utils' import { getCourseYearlyStats, CourseYearlyStats } from '../helpers' -void describe('Course yearly attempt statistics - TKT10002 (no substitutions)', () => { +void describe('Course yearly attempt statistics - TKT10002 (hy-CU-118023867, no substitutions)', () => { let app: Express beforeAll(async () => { app = await initTests() @@ -16,14 +16,14 @@ void describe('Course yearly attempt statistics - TKT10002 (no substitutions)', beforeAll(async () => { body = await getCourseYearlyStats( app, - `codes=TKT10002&combineSubstitutions=false&fromYearCode=${yearToYearCode(2016)}&toYearCode=${yearToYearCode(2023)}` + `courses=hy-CU-118023867&substitutions=false&fromYearCode=${yearToYearCode(2016)}&toYearCode=${yearToYearCode(2023)}` ) }) it('has one entry per statistic year', () => { - assert.strictEqual(body.unifyStats!.statistics.length, 8, 'unifyStats years') - assert.strictEqual(body.regularStats!.statistics.length, 8, 'regularStats years') - assert.strictEqual(body.openStats!.statistics.length, 4, 'openStats years') + assert.strictEqual(body.unifyStats.statistics.length, 8, 'unifyStats years') + assert.strictEqual(body.regularStats.statistics.length, 8, 'regularStats years') + assert.strictEqual(body.openStats.statistics.length, 4, 'openStats years') }) it.each([ @@ -60,7 +60,7 @@ void describe('Course yearly attempt statistics - TKT10002 (no substitutions)', ], ['2023-2024', { total: 1, passed: 1, failed: 0 }, { 5: 1, 4: 0, 3: 0, 2: 0, 1: 0, 0: 0, 'Hyl.': 0, 'Hyv.': 0 }], ])('for attempt statistic content during (%s)', (year, categories, grades) => { - const stats = body.unifyStats!.statistics.find(yearStats => yearStats.name === year)! + const stats = body.unifyStats.statistics.find(yearStats => yearStats.name === year)! assert('enrollments' in stats, 'Missing field enrollment in statsitics') assert.strictEqual( @@ -89,10 +89,10 @@ void describe('Course yearly attempt statistics - TKT10002 (no substitutions)', }) it('should include every attempt of a student who has failed a course in 2017 and later completed it', () => { - const year2017 = body.unifyStats!.statistics.find(year => year.name === '2017-2018') - const year2018 = body.unifyStats!.statistics.find(year => year.name === '2018-2019') - const year2020 = body.unifyStats!.statistics.find(year => year.name === '2020-2021') - const year2022 = body.unifyStats!.statistics.find(year => year.name === '2022-2023') + const year2017 = body.unifyStats.statistics.find(year => year.name === '2017-2018') + const year2018 = body.unifyStats.statistics.find(year => year.name === '2018-2019') + const year2020 = body.unifyStats.statistics.find(year => year.name === '2020-2021') + const year2022 = body.unifyStats.statistics.find(year => year.name === '2022-2023') assert(year2017 && 'enrollments' in year2017, 'Missing stats for 2017-2018') assert(year2018 && 'enrollments' in year2018, 'Missing stats for 2018-2019') assert(year2020 && 'enrollments' in year2020, 'Missing stats for 2020-2021') @@ -124,9 +124,9 @@ void describe('Course yearly attempt statistics - TKT10002 (no substitutions)', ])('should include correct attempt stats for one academic year (%s)', async (year, categories) => { const body = await getCourseYearlyStats( app, - `codes=TKT10002&combineSubstitutions=false&fromYearCode=${yearToYearCode(year.split('-').at(0))}&toYearCode=${yearToYearCode(parseInt(year.split('-').at(1)!)) - 1}` + `courses=hy-CU-118023867&substitutions=false&fromYearCode=${yearToYearCode(year.split('-').at(0))}&toYearCode=${yearToYearCode(parseInt(year.split('-').at(1)!)) - 1}` ) - const stats = body.unifyStats!.statistics.find(yearStats => yearStats.name === year)! + const stats = body.unifyStats.statistics.find(yearStats => yearStats.name === year)! assert('enrollments' in stats, 'Missing field enrollment in statsitics') assert.strictEqual( diff --git a/services/backend/tests/api/courses/courseYearlyStats/studentStatistics/mat11001.test.ts b/services/backend/tests/api/courses/courseYearlyStats/studentStatistics/mat11001.test.ts index 2490cdafe..48f2b4d82 100644 --- a/services/backend/tests/api/courses/courseYearlyStats/studentStatistics/mat11001.test.ts +++ b/services/backend/tests/api/courses/courseYearlyStats/studentStatistics/mat11001.test.ts @@ -4,16 +4,16 @@ import { describe, it, beforeAll, assert } from 'vitest' import { initTests } from '../../../../utils' import { calculatePassedAndFailed, getCourseYearlyStats, CourseYearlyStats } from '../helpers' -void describe('Course yearly statistics - MAT11001 (no substitutions)', () => { +void describe('Course yearly statistics - MAT11001 (hy-CU-117375151, no substitutions)', () => { let app: Express let body: CourseYearlyStats beforeAll(async () => { app = await initTests() - body = await getCourseYearlyStats(app, 'codes=MAT11001&combineSubstitutions=false') + body = await getCourseYearlyStats(app, 'courses=hy-CU-117375151&substitutions=false') }) it('should include a student who has only failed the course', () => { - const stats = body.unifyStats?.statistics!.find(year => year.name === '2018-2019') + const stats = body.unifyStats.statistics.find(year => year.name === '2018-2019') assert(stats && 'enrollments' in stats, 'Missing field enrollment in statsitics') const studentCategories = calculatePassedAndFailed(stats.students.grades) diff --git a/services/backend/tests/api/courses/courseYearlyStats/studentStatistics/mat11002.test.ts b/services/backend/tests/api/courses/courseYearlyStats/studentStatistics/mat11002.test.ts index 47a642f97..e0fad7d32 100644 --- a/services/backend/tests/api/courses/courseYearlyStats/studentStatistics/mat11002.test.ts +++ b/services/backend/tests/api/courses/courseYearlyStats/studentStatistics/mat11002.test.ts @@ -4,23 +4,27 @@ import { describe, it, beforeAll, assert } from 'vitest' import { initTests } from '../../../../utils' import { calculatePassedAndFailed, getCourseYearlyStats, CourseYearlyStats } from '../helpers' -void describe('Course yearly statistics - MAT11002 (no substitutions)', () => { +const courseCodeToGroupId = { + MAT11002: 'hy-CU-117375394', +} + +void describe('Course yearly statistics - MAT11002 (hy-CU-117375394, no substitutions)', () => { let app: Express let body: CourseYearlyStats beforeAll(async () => { app = await initTests() - body = await getCourseYearlyStats(app, 'codes=MAT11002&combineSubstitutions=false') + body = await getCourseYearlyStats(app, `courses=${courseCodeToGroupId.MAT11002}&combineSubstitutions=false`) }) it('should not include students for AY code', () => { - const stats = body.unifyStats?.statistics!.find(year => year.name === '2017-2018') + const stats = body.unifyStats.statistics.find(year => year.name === '2017-2018') assert(stats && 'enrollments' in stats, 'Missing field enrollment in statsitics') const studentCategories = calculatePassedAndFailed(stats.students.grades) assert(!studentCategories.failed.includes('534980')) }) it('should not include student with failed grade after passed grade', () => { - const year = body.unifyStats?.statistics.find(year => year.name === '2018-2019') + const year = body.unifyStats.statistics.find(year => year.name === '2018-2019') assert(year && 'enrollments' in year, 'Stats missing completely') const studentCategories = calculatePassedAndFailed(year.students.grades) assert(!studentCategories.failed.includes('501716'), 'Failed students included incorrectly the student in question') @@ -30,7 +34,7 @@ void describe('Course yearly statistics - MAT11002 (no substitutions)', () => { // FIXME: Doesn't test anything acually. Student doesn't have a passed AY grade it.skip('should include student with failed grade and passed AY grade', () => { - const year = body.unifyStats?.statistics.find(year => year.name === '2020-2021') + const year = body.unifyStats.statistics.find(year => year.name === '2020-2021') assert(year && 'enrollments' in year, 'Stats missing completely') const studentCategories = calculatePassedAndFailed(year.students.grades) assert( @@ -45,7 +49,7 @@ void describe('Course yearly statistics - MAT11002 (no substitutions)', () => { }) it('should include student with only approved grade', () => { - const year = body.unifyStats?.statistics.find(year => year.name === '2022-2023') + const year = body.unifyStats.statistics.find(year => year.name === '2022-2023') assert(year && 'enrollments' in year, 'Stats missing completely') const studentCategories = calculatePassedAndFailed(year.students.grades) assert(!studentCategories.failed.includes('543385'), 'Failed students included incorrectly the student in question') @@ -54,7 +58,7 @@ void describe('Course yearly statistics - MAT11002 (no substitutions)', () => { }) it('should not count a student with only improved grades as passed (509770)', () => { - const year = body.unifyStats?.statistics.find(year => year.name === '2018-2019') + const year = body.unifyStats.statistics.find(year => year.name === '2018-2019') assert(year && 'enrollments' in year, 'Missing stats for 2018-2019') const studentCategories = calculatePassedAndFailed(year.students.grades) diff --git a/services/backend/tests/api/courses/courseYearlyStats/studentStatistics/mat21003.test.ts b/services/backend/tests/api/courses/courseYearlyStats/studentStatistics/mat21003.test.ts index b42cf0449..8dca09c9d 100644 --- a/services/backend/tests/api/courses/courseYearlyStats/studentStatistics/mat21003.test.ts +++ b/services/backend/tests/api/courses/courseYearlyStats/studentStatistics/mat21003.test.ts @@ -5,6 +5,10 @@ import { yearToYearCode } from '@oodikone/shared/util' import { initTests } from '../../../../utils' import { calculatePassedAndFailed, getCourseYearlyStats, CourseYearlyStats } from '../helpers' +const courseCodeToGroupId = { + MAT21003: 'hy-CU-117375829', +} + void describe('Course yearly statistics - MAT21003 (no substitutions)', () => { let app: Express beforeAll(async () => { @@ -14,11 +18,11 @@ void describe('Course yearly statistics - MAT21003 (no substitutions)', () => { describe('duplicate failed grades across a large timespan are not double-counted', () => { let body: CourseYearlyStats beforeAll(async () => { - body = await getCourseYearlyStats(app, 'codes=MAT21003&combineSubstitutions=false') + body = await getCourseYearlyStats(app, `courses=${courseCodeToGroupId.MAT21003}&substitutions=false`) }) it('2017-2018 should not include a failed grade', () => { - const year = body.unifyStats?.statistics.find(year => year.name === '2017-2018') + const year = body.unifyStats.statistics.find(year => year.name === '2017-2018') assert(year && 'enrollments' in year, 'Missing stats for 2017-2018') const studentCategories = calculatePassedAndFailed(year.students.grades) assert.strictEqual(studentCategories.failed.length, 0, 'Failed stats should not include any students') @@ -26,7 +30,7 @@ void describe('Course yearly statistics - MAT21003 (no substitutions)', () => { }) it('2018-2019 should include a failed grade', () => { - const year = body.unifyStats?.statistics.find(year => year.name === '2018-2019') + const year = body.unifyStats.statistics.find(year => year.name === '2018-2019') assert(year && 'enrollments' in year, 'Missing stats for 2018-2019') const studentCategories = calculatePassedAndFailed(year.students.grades) assert.strictEqual(studentCategories.failed.length, 1, 'Failed stats should include only one student') @@ -42,7 +46,7 @@ void describe('Course yearly statistics - MAT21003 (no substitutions)', () => { ])('should include correct years for %s', async (name, from, to) => { const body = await getCourseYearlyStats( app, - `codes=MAT21003&combineSubstitutions=false&fromYearCode=${yearToYearCode(from)}&toYearCode=${yearToYearCode(to)}` + `courses=${courseCodeToGroupId.MAT21003}&substitutions=false&fromYearCode=${yearToYearCode(from)}&toYearCode=${yearToYearCode(to)}` ) const years: string[] = [] @@ -50,7 +54,7 @@ void describe('Course yearly statistics - MAT21003 (no substitutions)', () => { years.push(`${i}-${i + 1}`) } assert.deepStrictEqual( - body.unifyStats!.statistics.map(({ name }) => name), + body.unifyStats.statistics.map(({ name }) => name), years, `${name} included incorrect years` ) @@ -61,9 +65,9 @@ void describe('Course yearly statistics - MAT21003 (no substitutions)', () => { it('2017-2018 should include a failed grade', async () => { const body = await getCourseYearlyStats( app, - `codes=MAT21003&combineSubstitutions=false&fromYearCode=${yearToYearCode(2017)}&toYearCode=${yearToYearCode(2017)}` + `courses=${courseCodeToGroupId.MAT21003}&substitutions=false&fromYearCode=${yearToYearCode(2017)}&toYearCode=${yearToYearCode(2017)}` ) - const year = body.unifyStats!.statistics.find(year => year.name === '2017-2018') + const year = body.unifyStats.statistics.find(year => year.name === '2017-2018') assert(year && 'enrollments' in year, 'Missing stats for 2017-2018') const studentCategories = calculatePassedAndFailed(year.students.grades) @@ -74,9 +78,9 @@ void describe('Course yearly statistics - MAT21003 (no substitutions)', () => { it('2018-2019 should include a failed grade', async () => { const body = await getCourseYearlyStats( app, - `codes=MAT21003&combineSubstitutions=false&fromYearCode=${yearToYearCode(2018)}&toYearCode=${yearToYearCode(2018)}` + `courses=${courseCodeToGroupId.MAT21003}&substitutions=false&fromYearCode=${yearToYearCode(2018)}&toYearCode=${yearToYearCode(2018)}` ) - const year = body.unifyStats?.statistics.find(year => year.name === '2018-2019') + const year = body.unifyStats.statistics.find(year => year.name === '2018-2019') assert(year && 'enrollments' in year, 'Missing stats for 2018-2019') const studentCategories = calculatePassedAndFailed(year.students.grades) assert.deepStrictEqual( diff --git a/services/backend/tests/api/courses/courseYearlyStats/studentStatistics/tkt10002.test.ts b/services/backend/tests/api/courses/courseYearlyStats/studentStatistics/tkt10002.test.ts index 74301ae8e..d62a0a6f3 100644 --- a/services/backend/tests/api/courses/courseYearlyStats/studentStatistics/tkt10002.test.ts +++ b/services/backend/tests/api/courses/courseYearlyStats/studentStatistics/tkt10002.test.ts @@ -5,6 +5,10 @@ import { yearToYearCode } from '@oodikone/shared/util' import { initTests } from '../../../../utils' import { calculatePassedAndFailed, getCourseYearlyStats, CourseYearlyStats } from '../helpers' +const courseCodeToGroupId = { + TKT10002: 'hy-CU-118023867', +} + void describe('Course yearly statistics - TKT10002 (no substitutions)', () => { let app: Express beforeAll(async () => { @@ -16,19 +20,19 @@ void describe('Course yearly statistics - TKT10002 (no substitutions)', () => { beforeAll(async () => { body = await getCourseYearlyStats( app, - `codes=TKT10002&combineSubstitutions=false&fromYearCode=${yearToYearCode(2016)}&toYearCode=${yearToYearCode(2023)}` + `courses=${courseCodeToGroupId.TKT10002}&substitutions=false&fromYearCode=${yearToYearCode(2016)}&toYearCode=${yearToYearCode(2023)}` ) }) it('has one entry per statistic year', () => { - assert.strictEqual(body.unifyStats!.statistics.length, 8, 'unifyStats years') - assert.strictEqual(body.regularStats!.statistics.length, 8, 'regularStats years') - assert.strictEqual(body.openStats!.statistics.length, 4, 'openStats years') + assert.strictEqual(body.unifyStats.statistics.length, 8, 'unifyStats years') + assert.strictEqual(body.regularStats.statistics.length, 8, 'regularStats years') + assert.strictEqual(body.openStats.statistics.length, 4, 'openStats years') // Faculties should have the same amount of years as normal statistics (above) - assert.strictEqual(Object.keys(body.unifyStats!.facultyStats).length, 8, 'unifyStats years') - assert.strictEqual(Object.keys(body.regularStats!.facultyStats).length, 8, 'regularStats years') - assert.strictEqual(Object.keys(body.openStats!.facultyStats).length, 4, 'openStats years') + assert.strictEqual(Object.keys(body.unifyStats.facultyStats).length, 8, 'unifyStats years') + assert.strictEqual(Object.keys(body.regularStats.facultyStats).length, 8, 'regularStats years') + assert.strictEqual(Object.keys(body.openStats.facultyStats).length, 4, 'openStats years') }) // TODO: Rewrite /courseyearlystats so that total = passed + failed + enrolledNoGrade @@ -76,7 +80,7 @@ void describe('Course yearly statistics - TKT10002 (no substitutions)', () => { { 5: 1, 4: 0, 3: 0, 2: 0, 1: 0, 0: 0, 'Hyv.': 0 }, ], ])('for statistic content during ($0)', (year, categories, grades) => { - const stats = body.unifyStats!.statistics.find(yearStats => yearStats.name === year)! + const stats = body.unifyStats.statistics.find(yearStats => yearStats.name === year)! assert('enrollments' in stats, 'Missing field enrollment in statsitics') const studentCategories = calculatePassedAndFailed(stats.students.grades) @@ -115,24 +119,18 @@ void describe('Course yearly statistics - TKT10002 (no substitutions)', () => { }) it('should include students who have failed a course and then completed it only once', () => { - const stats2017 = body.unifyStats!.statistics.find(year => year.name === '2017-2018')! + const stats2017 = body.unifyStats.statistics.find(year => year.name === '2017-2018')! const { studentNumbers } = stats2017.students - - assert( - !( - ( - '457686' in studentNumbers || // SPRING 2019 - '455478' in studentNumbers || // FALL 2020 - '547994' in studentNumbers - ) // FALL 2022 - ), + assert.notIncludeMembers( + studentNumbers, + ['457686' /* SPRING 2019*/, '455478' /* FALL 2020 */, '547994' /* FALL 2022*/], "Students that have completed course later should not be included in the previous year's stats" ) - const year2017 = body.unifyStats!.statistics.find(year => year.name === '2017-2018') - const year2018 = body.unifyStats!.statistics.find(year => year.name === '2018-2019') - const year2020 = body.unifyStats!.statistics.find(year => year.name === '2020-2021') - const year2022 = body.unifyStats!.statistics.find(year => year.name === '2022-2023') + const year2017 = body.unifyStats.statistics.find(year => year.name === '2017-2018') + const year2018 = body.unifyStats.statistics.find(year => year.name === '2018-2019') + const year2020 = body.unifyStats.statistics.find(year => year.name === '2020-2021') + const year2022 = body.unifyStats.statistics.find(year => year.name === '2022-2023') assert(year2017 && 'enrollments' in year2017, 'Missing stats for 2017-2018') assert(year2018 && 'enrollments' in year2018, 'Missing stats for 2018-2019') assert(year2020 && 'enrollments' in year2020, 'Missing stats for 2020-2021') @@ -172,8 +170,8 @@ void describe('Course yearly statistics - TKT10002 (no substitutions)', () => { }) it("should mark student's enrollment time correctly with mismatched semestercode and enrollment_date_time", () => { - const stats2021 = body.unifyStats!.statistics.find(year => year.name === '2021-2022')! - const stats2022 = body.unifyStats!.statistics.find(year => year.name === '2022-2023')! + const stats2021 = body.unifyStats.statistics.find(year => year.name === '2021-2022')! + const stats2022 = body.unifyStats.statistics.find(year => year.name === '2022-2023')! assert('enrollments' in stats2021, 'Missing field enrollment in statsitics (2021)') assert('enrollments' in stats2022, 'Missing field enrollment in statsitics (2022)') // Student with enrollment_date_time outside of semestert start and end dates @@ -238,9 +236,9 @@ void describe('Course yearly statistics - TKT10002 (no substitutions)', () => { ])('should include correct stats for one academic year ($0)', async (year, categories, grades) => { const body = await getCourseYearlyStats( app, - `codes=TKT10002&combineSubstitutions=false&fromYearCode=${yearToYearCode(year.split('-').at(0))}&toYearCode=${yearToYearCode(parseInt(year.split('-').at(1)!)) - 1}` + `courses=${courseCodeToGroupId.TKT10002}&substitutions=false&fromYearCode=${yearToYearCode(year.split('-').at(0))}&toYearCode=${yearToYearCode(parseInt(year.split('-').at(1)!)) - 1}` ) - const stats = body.unifyStats!.statistics.find(yearStats => yearStats.name === year)! + const stats = body.unifyStats.statistics.find(yearStats => yearStats.name === year)! assert('enrollments' in stats, 'Missing field enrollment in statsitics') const studentCategories = calculatePassedAndFailed(stats.students.grades)