diff --git a/src/Handler/Corrections.hs b/src/Handler/Corrections.hs index c3a2574fe..851c1b1c4 100644 --- a/src/Handler/Corrections.hs +++ b/src/Handler/Corrections.hs @@ -1085,7 +1085,7 @@ assignHandler tid ssh csh cid assignSids = do (btnWdgt, btnResult) <- runButtonForm FIDAssignSubmissions -- gather data - (assignSheetNames, nrParticipants, groupsPossible, infoMap, correctorMap, assignment, lecturerNames) <- runDB $ do + (assignSheetNames, nrParticipants, groupsPossible, infoMap, correctorMap, assignment) <- runDB $ do -- cid <- getKeyBy404 $ TermSchoolCourseShort tid ssh csh nrParticipants <- count [CourseParticipantCourse ==. cid] @@ -1141,11 +1141,11 @@ assignHandler tid ssh csh cid assignSids = do in Map.insertWith (\(usr, ma) (_, mb) -> (usr, Map.union ma mb)) uid (user, Map.singleton shn sheetcorr) acc ) - -- lecturerNames :: Map UserId User - lecturerNames <- fmap entities2map $ E.select $ E.from $ \(user `E.InnerJoin` lecturer) -> do - E.on $ user E.^. UserId E.==. lecturer E.^. LecturerUser - E.where_ $ lecturer E.^. LecturerCourse E.==. E.val cid - return user + -- -- lecturerNames :: Map UserId User + -- lecturerNames <- fmap entities2map $ E.select $ E.from $ \(user `E.InnerJoin` lecturer) -> do + -- E.on $ user E.^. UserId E.==. lecturer E.^. LecturerUser + -- E.where_ $ lecturer E.^. LecturerCourse E.==. E.val cid + -- return user submissions <- E.select . E.from $ \submission -> do E.where_ $ submission E.^. SubmissionSheet `E.in_` E.valList sheetIds @@ -1179,7 +1179,7 @@ assignHandler tid ssh csh cid assignSids = do } in Map.insertWith (Map.unionWith (<>)) shnm cinf m - return (assignSheetNames, nrParticipants, groupsPossible, infoMap, correctorMap, assignment, lecturerNames) + return (assignSheetNames, nrParticipants, groupsPossible, infoMap, correctorMap, assignment) let -- infoMap :: Map SheetName (Map (Maybe UserId) CorrectionInfo) -- repeated here for easier reference -- create aggregate maps @@ -1218,8 +1218,8 @@ assignHandler tid ssh csh cid assignSids = do getCorrector (Just uid) | Just (User{..},loadMap) <- Map.lookup uid correctorMap = (nameEmailWidget userEmail userDisplayName userSurname, loadMap) - | Just (User{..} ) <- Map.lookup uid lecturerNames - = (nameEmailWidget userEmail userDisplayName userSurname, mempty) -- lecturers may also correct in rare cases + -- | Just (User{..} ) <- Map.lookup uid lecturerNames + -- = (nameEmailWidget userEmail userDisplayName userSurname, mempty) -- lecturers may also correct in rare cases getCorrector _ = ([whamlet|_{MsgNoCorrectorAssigned}|], mempty) -- avoid nestes hamlet $maybe with duplicated $nothing getCorrSheetStatus :: Maybe UserId -> SheetName -> Maybe CorrectionInfo diff --git a/src/Handler/Utils/Corrections.hs b/src/Handler/Utils/Corrections.hs index ca5d433d7..2fd58de80 100644 --- a/src/Handler/Utils/Corrections.hs +++ b/src/Handler/Utils/Corrections.hs @@ -30,6 +30,8 @@ instance Semigroup CorrectionInfo where mergeWith prj f = on f prj corrA corrB keepEqual (Just x) (Just y) | x==y = Just x + keepEqual Nothing other = other + keepEqual other Nothing = other keepEqual _ _ = Nothing instance Monoid CorrectionInfo where