Skip to content

Commit 433570f

Browse files
committed
[ProgressTab] Readd ablity to read progress data based on programme start year
1 parent 7bf8c54 commit 433570f

File tree

6 files changed

+46
-32
lines changed

6 files changed

+46
-32
lines changed

services/backend/src/services/populations/formatStatisticsForApi.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,12 @@ const getProgressCriteria = (
131131
})
132132

133133
yearMap.forEach(([yearToAdd, criteriaYear]) => {
134+
criteriaChecked[yearToAdd].totalSatisfied +=
135+
Object.values(criteriaChecked[yearToAdd].coursesSatisfied).filter(course => !!course).length ?? 0
134136
// UPDATE CREDIT CRITERIA
135137
if (!!criteria.credits[criteriaYear] && criteria.credits[criteriaYear] < academicYears[yearToAdd]) {
136138
criteriaChecked[yearToAdd].credits = true
139+
criteriaChecked[yearToAdd].totalSatisfied += 1
137140
}
138141
})
139142

services/frontend/src/components/OodiTable/components/Cell.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import type { FC } from 'react'
88
import { getCommonPinningStyles } from '../styles'
99

1010
const OodiTableCell: FC<TableCellProps> = ({ children, ...props }) => {
11-
// console.log(props)
12-
1311
return (
1412
<TableCell
1513
{...props}

services/frontend/src/components/PopulationStudents/StudentTable/GeneralTab/columnHelpers/semestersPresent.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* These should inherit the width and height from .enrollment-label-no-margin */
1+
/* These should inherit the width and height from .enrollment-label */
22

33
/* Instead we inflate the size and offset the svg... */
44

services/frontend/src/components/PopulationStudents/StudentTable/ProgressTab/index.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@
55
border-radius: 0.25em;
66
}
77

8+
.enrollment-label-no-margin {
9+
margin: 0 !important;
10+
}
11+
812
.enrollment-label:nth-of-type(even):not(:last-child) {
913
margin-right: 6px;
1014
}

services/frontend/src/components/PopulationStudents/StudentTable/ProgressTab/index.jsx

Lines changed: 29 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -286,8 +286,8 @@ export const ProgressTable = ({ curriculum, criteria, students, months, programm
286286
const springText = `Spring: ${helpTexts[spring]}`
287287
return (
288288
<div style={{ display: 'flex', justifyContent: 'center', gap: '0.2rem' }}>
289-
<div className={`enrollment-label-no-margin ${enrollmentTypes[fall]?.className}`} title={fallText} />
290-
<div className={`enrollment-label-no-margin ${enrollmentTypes[spring]?.className}`} title={springText} />
289+
<div className={`enrollment-label ${enrollmentTypes[fall]?.className}`} title={fallText} />
290+
<div className={`enrollment-label ${enrollmentTypes[spring]?.className}`} title={springText} />
291291
</div>
292292
)
293293
}
@@ -347,8 +347,7 @@ export const ProgressTable = ({ curriculum, criteria, students, months, programm
347347
const semesters = Object.values(allSemesters)
348348
.filter(
349349
semester =>
350-
dayjs(semester.startdate).isSameOrAfter(startYear) &&
351-
dayjs(semester.enddate).isSameOrBefore(endYear.add(1, 'day'))
350+
dayjs(semester.startdate).isSameOrAfter(startYear) && dayjs(semester.enddate).isSameOrBefore(endYear)
352351
)
353352
.map(semester => semester.semestercode)
354353
return {
@@ -476,9 +475,6 @@ export const ProgressTable = ({ curriculum, criteria, students, months, programm
476475

477476
const isCriteriaSet =
478477
criteria && Object.keys(criteria.courses).some(yearCourses => criteria.courses[yearCourses].length > 0)
479-
const studentData = useMemo(() => {
480-
return students
481-
}, [students])
482478

483479
return (
484480
<>
@@ -488,30 +484,39 @@ export const ProgressTable = ({ curriculum, criteria, students, months, programm
488484
after changes.
489485
</h5>
490486
)}
491-
<Message style={{ fontSize: '16px', maxWidth: '700px' }}>
492-
<p>
493-
<Icon color="green" fitted name="check" />: Student has passed the course in the academic year. <br />
494-
<Icon color="grey" fitted name="check" />: Student has passed the course outside of the corresponding academic
495-
year. <br />
496-
<Icon color="green" fitted name="clipboard check" />: Student has credit transfer for the course. <br />
497-
<Icon color="red" fitted name="times" />: Student has failed the course. <br />
498-
<Icon color="grey" fitted name="minus" />: Student has enrolled, but has not received any grade from the
499-
course. <br />
500-
<span className="enrollment-label-no-margin label-present" />: Student has an active semester enrollment.
501-
<br />
502-
<span className="enrollment-label-no-margin label-absent" />: Student has enrolled as absent. <br />
503-
<span className="enrollment-label-no-margin label-passive" />: Inactive: Student did not enroll at all. <br />
504-
<span className="enrollment-label-no-margin label-none" />: Student has no enrollment, but also no study right
505-
for the semester.
506-
</p>
487+
<Message>
488+
<Icon color="green" fitted name="check" />: Student has passed the course in the academic year. <br />
489+
<Icon color="grey" fitted name="check" />: Student has passed the course outside of the corresponding academic
490+
year. <br />
491+
<Icon color="green" fitted name="clipboard check" />: Student has credit transfer for the course. <br />
492+
<Icon color="red" fitted name="times" />: Student has failed the course. <br />
493+
<Icon color="grey" fitted name="minus" />: Student has enrolled, but has not received any grade from the course.{' '}
494+
<br />
495+
<span
496+
className="enrollment-label enrollment-label-no-margin label-present"
497+
style={{ display: 'inline-block' }}
498+
/>
499+
: Student has an active semester enrollment. <br />
500+
<span
501+
className="enrollment-label enrollment-label-no-margin label-absent"
502+
style={{ display: 'inline-block' }}
503+
/>
504+
: Student has enrolled as absent. <br />
505+
<span
506+
className="enrollment-label enrollment-label-no-margin label-passive"
507+
style={{ display: 'inline-block' }}
508+
/>
509+
: Inactive: Student did not enroll at all. <br />
510+
<span className="enrollment-label enrollment-label-no-margin label-none" style={{ display: 'inline-block' }} />:
511+
Student has no enrollment, but also no study right for the semester. <br />
507512
</Message>
508513
<Tab.Pane>
509514
<div style={{ display: 'flex' }}>
510515
<div style={{ maxHeight: '80vh', width: '100%' }}>
511516
{isCriteriaSet ? (
512517
<SortableTable
513518
columns={columns}
514-
data={studentData}
519+
data={students}
515520
featureName="progress"
516521
style={{ height: '80vh' }}
517522
tableId="progress-of-population-students"

services/frontend/src/components/PopulationStudents/index.tsx

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { useTabChangeAnalytics } from '@/hooks/tabChangeAnalytics'
88
import { useToggle } from '@/hooks/toggle'
99
import { ExtendedCurriculumDetails } from '@/hooks/useCurriculums'
1010
import { useGetAuthorizedUserQuery } from '@/redux/auth'
11+
import { parseQueryParams } from '@/util/queryparams'
1112
import { isBachelorOrLicentiateProgramme } from '@/util/studyProgramme'
1213
import { ProgressCriteria } from '@oodikone/shared/types'
1314
import { CheckStudentList } from './CheckStudentList'
@@ -83,6 +84,13 @@ export const PopulationStudents = ({
8384
if (!['population', 'customPopulation', 'coursePopulation', 'studyGuidanceGroupPopulation'].includes(variant))
8485
throw new Error(`${variant} is not a proper variant!`)
8586

87+
const { years } = parseQueryParams(location.search)
88+
const months = years
89+
? dayjs().diff(dayjs(`${Math.min(years)}-08-01`), 'months')
90+
: studyGuidanceGroup?.tags?.year
91+
? dayjs().diff(dayjs(`${studyGuidanceGroup?.tags?.year}-08-01`), 'months')
92+
: undefined
93+
8694
const availableTabs = {
8795
General: () => (
8896
<GeneralTab
@@ -109,11 +117,7 @@ export const PopulationStudents = ({
109117
<ProgressTab
110118
criteria={criteria}
111119
curriculum={curriculum}
112-
months={
113-
studyGuidanceGroup?.tags?.year
114-
? dayjs().diff(dayjs(`${studyGuidanceGroup?.tags?.year}-08-01`), 'months')
115-
: undefined
116-
}
120+
months={months}
117121
programme={programme}
118122
students={filteredStudents}
119123
studyGuidanceGroupProgramme={programme}

0 commit comments

Comments
 (0)