Skip to content

Commit

Permalink
fix: filter semesters summary properly (again)
Browse files Browse the repository at this point in the history
  • Loading branch information
evermake committed Apr 7, 2024
1 parent bc327a4 commit 1684302
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions backend/src/domain/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,22 @@ export class Domain {
const hours = allSportHours.find(h => h.id_sem === id)
const fitTest = allFitnessTests.find(t => t.semester === name)

let hasSomeHours = hours != null && (
hours.hours_not_self !== 0
|| hours.hours_self_not_debt !== 0
|| hours.hours_self_debt !== 0
|| hours.debt !== 0
)
if (!hasSomeHours && id === sportHours.ongoing_semester.id_sem) {
hasSomeHours = true
}

return {
title: name,
hoursTotal: hours
? (hours.hours_not_self + hours.hours_self_debt + hours.hours_self_not_debt)
hoursTotal: hasSomeHours
? hours
? (hours.hours_not_self + hours.hours_self_debt + hours.hours_self_not_debt)
: 0
: undefined,
fitnessTest: fitTest
? {
Expand Down

0 comments on commit 1684302

Please sign in to comment.