Skip to content

Commit

Permalink
[Completed courses of students] Display an icon for courses that are …
Browse files Browse the repository at this point in the history
…in students' HOPS but have no enrollment or completion
  • Loading branch information
joonas-a committed Jan 28, 2025
1 parent 30b1a31 commit 66b5e9a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { Done as DoneIcon, Remove as RemoveIcon } from '@mui/icons-material'
import { Done as DoneIcon, Remove as RemoveIcon, CropSquare as SquareIcon } from '@mui/icons-material'
import { Box, Stack } from '@mui/material'
import { green, yellow, grey } from '@mui/material/colors'
import { MaterialReactTable, MRT_ColumnDef, useMaterialReactTable } from 'material-react-table'
import moment from 'moment'
import { useEffect, useMemo, useState } from 'react'

import { useLanguage } from '@/components/LanguagePicker/useLanguage'
import { ExportToExcelDialog } from '@/components/material/ExportToExcelDialog'
import { RightsNotification } from '@/components/material/RightsNotification'
Expand All @@ -24,8 +23,13 @@ const getTotalUnfinished = student => Object.values(student.enrollments).length
const getCompletion = (student, courseCode, { icon }) => {
const completion = student.credits.find(credit => credit.courseCode === courseCode && isPassed(credit.creditType))
const enrollment = student.enrollments[courseCode]
const isInStudyPlan = student.coursesInStudyPlan.includes(courseCode)

if (completion === undefined) {
if (!enrollment) {
if (isInStudyPlan) {
return <SquareIcon fontSize="small" style={{ color: grey[500] }} />
}
return null
}
if (icon) {
Expand All @@ -47,7 +51,7 @@ const getCellTitle = (student, courseCode) => {
const credit = student.credits.find(credit => credit.courseCode === courseCode)
const enrollment = student.enrollments[courseCode]
if (!credit && !enrollment) {
return ''
return 'Student has the course in their primary study plan'
}
const title = credit
? `Passed on ${moment(credit.date).format(ISO_DATE_FORMAT)}\nCourse code: ${
Expand Down
9 changes: 7 additions & 2 deletions services/frontend/src/pages/CompletedCoursesSearch/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Done as DoneIcon, Remove as RemoveIcon } from '@mui/icons-material'
import { Done as DoneIcon, Remove as RemoveIcon, CropSquare as SquareIcon } from '@mui/icons-material'
import { Alert, Box, Container, Stack } from '@mui/material'
import { green, yellow, grey } from '@mui/material/colors'
import { useState } from 'react'
Expand All @@ -20,7 +20,8 @@ export const CompletedCourses = () => {
<Box mb={1}>
Here you can search by a list of student and course numbers to see whether students have completed certain
courses yet. The tool will also show if students have enrolled on the course, if they have not yet completed
it. Course substitutions are taken into account.
it, or if they have the course selected in their primary study plan. Course substitutions are taken into
account.
</Box>
<Stack direction="row">
<DoneIcon fontSize="small" style={{ color: green[700] }} />: Student has completed the course with a passing
Expand All @@ -34,6 +35,10 @@ export const CompletedCourses = () => {
<RemoveIcon fontSize="small" style={{ color: grey[700] }} />: Student has not completed the course, but has
an enrollment from more than 6 months ago.
</Stack>
<Stack direction="row">
<SquareIcon fontSize="small" style={{ color: grey[500] }} />: Student has the course in their primary study
plan, but has not enrolled to, or completed it.
</Stack>
<b>Empty cell</b>: Student has no completion or enrollment for the course.
</Alert>
<SearchModal setValues={setValues} />
Expand Down

0 comments on commit 66b5e9a

Please sign in to comment.