Skip to content

Commit

Permalink
[Completed courses] Hover shows exact course code
Browse files Browse the repository at this point in the history
  • Loading branch information
ShootingStar91 committed Jan 3, 2024
1 parent d2995ad commit f0f82e9
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,18 @@ const getColumns = (courses, showStudentNames, getTextIn) => {
]

const getCellProps = (student, courseCode) => {
const creditDate = student.credits.find(credit => credit.courseCode === courseCode)?.date
const enrollmentDate = student.enrollments[courseCode]?.date
if (!creditDate && !enrollmentDate) {
const credit = student.credits.find(credit => credit.courseCode === courseCode)
const enrollment = student.enrollments[courseCode]
if (!credit && !enrollment) {
return { style }
}
const title = creditDate
? `Passed on ${moment(creditDate).format('YYYY-MM-DD')} `
: `Last enrollment on ${moment(enrollmentDate).format('YYYY-MM-DD')} `
const title = credit
? `Passed on ${moment(credit.date).format('YYYY-MM-DD')}\nCourse code: ${
credit.substitution ? credit.substitution : credit.courseCode
}`
: `Last enrollment on ${moment(enrollment.date).format('YYYY-MM-DD')}\nCourse code ${
enrollment.substitution ? enrollment.substitution : enrollment.courseCode
}`
return { style, title }
}

Expand Down

0 comments on commit f0f82e9

Please sign in to comment.