Better fix for lecturer names
This commit is contained in:
parent
16c556b852
commit
8476314a46
@ -1085,7 +1085,7 @@ assignHandler tid ssh csh cid assignSids = do
|
|||||||
(btnWdgt, btnResult) <- runButtonForm FIDAssignSubmissions
|
(btnWdgt, btnResult) <- runButtonForm FIDAssignSubmissions
|
||||||
|
|
||||||
-- gather data
|
-- 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
|
-- cid <- getKeyBy404 $ TermSchoolCourseShort tid ssh csh
|
||||||
nrParticipants <- count [CourseParticipantCourse ==. cid]
|
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
|
in Map.insertWith (\(usr, ma) (_, mb) -> (usr, Map.union ma mb)) uid (user, Map.singleton shn sheetcorr) acc
|
||||||
)
|
)
|
||||||
|
|
||||||
-- lecturerNames :: Map UserId User
|
-- -- lecturerNames :: Map UserId User
|
||||||
lecturerNames <- fmap entities2map $ E.select $ E.from $ \(user `E.InnerJoin` lecturer) -> do
|
-- lecturerNames <- fmap entities2map $ E.select $ E.from $ \(user `E.InnerJoin` lecturer) -> do
|
||||||
E.on $ user E.^. UserId E.==. lecturer E.^. LecturerUser
|
-- E.on $ user E.^. UserId E.==. lecturer E.^. LecturerUser
|
||||||
E.where_ $ lecturer E.^. LecturerCourse E.==. E.val cid
|
-- E.where_ $ lecturer E.^. LecturerCourse E.==. E.val cid
|
||||||
return user
|
-- return user
|
||||||
|
|
||||||
submissions <- E.select . E.from $ \submission -> do
|
submissions <- E.select . E.from $ \submission -> do
|
||||||
E.where_ $ submission E.^. SubmissionSheet `E.in_` E.valList sheetIds
|
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
|
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
|
let -- infoMap :: Map SheetName (Map (Maybe UserId) CorrectionInfo) -- repeated here for easier reference
|
||||||
-- create aggregate maps
|
-- create aggregate maps
|
||||||
@ -1218,8 +1218,8 @@ assignHandler tid ssh csh cid assignSids = do
|
|||||||
getCorrector (Just uid)
|
getCorrector (Just uid)
|
||||||
| Just (User{..},loadMap) <- Map.lookup uid correctorMap
|
| Just (User{..},loadMap) <- Map.lookup uid correctorMap
|
||||||
= (nameEmailWidget userEmail userDisplayName userSurname, loadMap)
|
= (nameEmailWidget userEmail userDisplayName userSurname, loadMap)
|
||||||
| Just (User{..} ) <- Map.lookup uid lecturerNames
|
-- | Just (User{..} ) <- Map.lookup uid lecturerNames
|
||||||
= (nameEmailWidget userEmail userDisplayName userSurname, mempty) -- lecturers may also correct in rare cases
|
-- = (nameEmailWidget userEmail userDisplayName userSurname, mempty) -- lecturers may also correct in rare cases
|
||||||
getCorrector _ = ([whamlet|_{MsgNoCorrectorAssigned}|], mempty)
|
getCorrector _ = ([whamlet|_{MsgNoCorrectorAssigned}|], mempty)
|
||||||
-- avoid nestes hamlet $maybe with duplicated $nothing
|
-- avoid nestes hamlet $maybe with duplicated $nothing
|
||||||
getCorrSheetStatus :: Maybe UserId -> SheetName -> Maybe CorrectionInfo
|
getCorrSheetStatus :: Maybe UserId -> SheetName -> Maybe CorrectionInfo
|
||||||
|
|||||||
@ -30,6 +30,8 @@ instance Semigroup CorrectionInfo where
|
|||||||
mergeWith prj f = on f prj corrA corrB
|
mergeWith prj f = on f prj corrA corrB
|
||||||
|
|
||||||
keepEqual (Just x) (Just y) | x==y = Just x
|
keepEqual (Just x) (Just y) | x==y = Just x
|
||||||
|
keepEqual Nothing other = other
|
||||||
|
keepEqual other Nothing = other
|
||||||
keepEqual _ _ = Nothing
|
keepEqual _ _ = Nothing
|
||||||
|
|
||||||
instance Monoid CorrectionInfo where
|
instance Monoid CorrectionInfo where
|
||||||
|
|||||||
Reference in New Issue
Block a user