Skip to content
This repository has been archived by the owner on Dec 29, 2019. It is now read-only.

Commit

Permalink
Fixed exam result display
Browse files Browse the repository at this point in the history
  • Loading branch information
keyraphi committed Sep 27, 2019
1 parent 44f5dad commit 0700b80
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/Pages/CourseDetail.elm
Original file line number Diff line number Diff line change
Expand Up @@ -1456,17 +1456,25 @@ successFoldFunction key exam acc =
filterExam : Dict Int Exam -> Dict Int ExamEnrollment -> List ( Int, Exam )
filterExam exams enrollments =
let
joinedExamAndEnrollment =
Dict.merge
(\_ _ acc -> acc)
(\key a b -> Dict.insert key ( a, b ))
(\_ _ acc -> acc)
exams
enrollments
Dict.empty

examSuccess =
List.map2
(\( id, a ) ( id1, b ) ->
if id == id1 && b.status == 1 then
( True, id, a )
List.map
(\( id, ( exam, enrollment ) ) ->
if enrollment.status == 1 then
( True, id, exam )

else
( False, id, a )
( False, id, exam )
)
(Dict.toList exams)
(Dict.toList enrollments)
(Dict.toList joinedExamAndEnrollment)
in
List.map (\( use, id, exam ) -> ( id, exam ))
(List.filter (\( use, id, exam ) -> use) examSuccess)
Expand Down

0 comments on commit 0700b80

Please sign in to comment.