Skip to content

Commit fc75dfd

Browse files
committed
[StudyTrackStats+E2E] Include graduated back in all students in charts
1 parent 97d332d commit fc75dfd

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

cypress/e2e/Degree_programme_overview.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -398,16 +398,16 @@ describe('Degree programme overview', () => {
398398
it('Student progress data is shown correctly', () => {
399399
const years = getEmptyYears(true)
400400
const tableContents = [
401-
// [Year, All, < 30 credits, 30–60 credits, 60–90 credits, 90–120 credits, 120–150 credits, 150–180 credits, ≥ 180 credits]
402-
...years.map(year => [year, 0, 0, 0, 0, 0, 0, 0, 0]),
403-
['2023 - 2024', 8, 8, 0, 0, 0, 0, 0, 0],
404-
['2022 - 2023', 26, 9, 9, 4, 3, 0, 1, 0],
405-
['2021 - 2022', 38, 8, 6, 11, 8, 5, 0, 0],
406-
['2020 - 2021', 30, 2, 1, 3, 7, 4, 4, 9],
407-
['2019 - 2020', 35, 1, 0, 2, 1, 0, 4, 27],
408-
['2018 - 2019', 45, 0, 1, 1, 2, 0, 3, 38],
409-
['2017 - 2018', 47, 0, 1, 3, 0, 1, 2, 40],
410-
['Total', 229, 28, 18, 24, 21, 10, 14, 114],
401+
// [Year, All, < 30 credits, 30–60 credits, 60–90 credits, 90–120 credits, 120–150 credits, 150–180 credits, ≥ 180 credits, Graduated]
402+
...years.map(year => [year, 0, 0, 0, 0, 0, 0, 0, 0, 0]),
403+
['2023 - 2024', 8, 8, 0, 0, 0, 0, 0, 0, 0],
404+
['2022 - 2023', 26, 9, 8, 4, 3, 0, 0, 0, 2],
405+
['2021 - 2022', 38, 8, 4, 9, 8, 4, 0, 0, 5],
406+
['2020 - 2021', 30, 2, 1, 2, 5, 0, 0, 1, 19],
407+
['2019 - 2020', 35, 1, 0, 2, 1, 0, 0, 4, 27],
408+
['2018 - 2019', 45, 0, 1, 1, 2, 0, 0, 2, 39],
409+
['2017 - 2018', 47, 0, 1, 3, 0, 0, 1, 0, 42],
410+
['Total', 229, 28, 15, 21, 19, 4, 1, 7, 134],
411411
]
412412

413413
cy.checkTableStats(tableContents, 'study-programme-progress')
@@ -423,7 +423,7 @@ describe('Degree programme overview', () => {
423423
.should('contain', '58.5%') // The percentage for total graduated, to check that the graph renders
424424

425425
cy.cs('programme-progress-bar-chart-section').contains('58.5%').trigger('mouseover', { force: true })
426-
cy.contains('At least 180 credits: 7')
426+
cy.contains('Graduated: 134')
427427
})
428428

429429
it('Average graduation times section', () => {

services/frontend/src/util/faculty.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,12 +83,13 @@ export const calculateStats = (
8383
}
8484

8585
Object.keys(creditCounts).forEach(year => {
86+
const yearGraduatedCount = graduatedCount ? graduatedCount[year] : 0
8687
const yearCreditCount = creditCounts[year]
87-
const yearCounts = [year, yearCreditCount.length]
88+
const yearCounts = [year, yearCreditCount.length + yearGraduatedCount]
8889

8990
for (const limit of limits) {
90-
if (limit == 'Graduated') {
91-
yearCounts.push(graduatedCount ? graduatedCount[year] : 0)
91+
if (limit === 'Graduated') {
92+
yearCounts.push(yearGraduatedCount)
9293
} else {
9394
yearCounts.push(yearCreditCount.filter(credits => isBetween(credits, limit[0], limit[1])).length)
9495
}

0 commit comments

Comments
 (0)