fix(assign correctors): also show names of unenlisted correctors
This commit is contained in:
parent
9c5ed5f842
commit
de49a777eb
@ -1138,17 +1138,22 @@ assignHandler tid ssh csh cid assignSids = do
|
||||
E.on $ corrector E.^. SheetCorrectorUser E.==. user E.^. UserId
|
||||
E.where_ $ corrector E.^. SheetCorrectorSheet `E.in_` E.valList sheetIds
|
||||
return (corrector, user)
|
||||
let correctorMap :: Map UserId (User, Map SheetName SheetCorrector)
|
||||
correctorMap = (\f -> foldl f Map.empty correctors) (\acc (Entity _ sheetcorr@SheetCorrector{sheetCorrectorSheet}, Entity uid user) ->
|
||||
let shn = sheetName $ sheets ! sheetCorrectorSheet
|
||||
in Map.insertWith (\(usr, ma) (_, mb) -> (usr, Map.union ma mb)) uid (user, Map.singleton shn sheetcorr) acc
|
||||
)
|
||||
let regular_correctors = nub $ fmap (\(_,Entity uid _) -> uid) correctors
|
||||
act_correctors <- E.select . E.distinct . E.from $ \(submission `E.InnerJoin` user) -> do
|
||||
E.on $ submission E.^. SubmissionRatingBy E.==. (E.just $ user E.^. UserId)
|
||||
E.where_ $ submission E.^. SubmissionSheet `E.in_` E.valList sheetIds
|
||||
E.where_ $ user E.^. UserId `E.notIn` E.valList regular_correctors
|
||||
return (submission E.^. SubmissionSheet, 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
|
||||
let fakeSheetCorrector :: (E.Value SheetId, Entity User) -> (Entity SheetCorrector, Entity User)
|
||||
fakeSheetCorrector (E.Value shid, usr@(Entity uid _)) = (Entity (error "Fake SheetId") (SheetCorrector uid shid mempty CorrectorExcused), usr)
|
||||
|
||||
let correctorMap :: Map UserId (User, Map SheetName SheetCorrector)
|
||||
correctorMap = (\f -> foldl f Map.empty (correctors ++ (fakeSheetCorrector <$> act_correctors)) )
|
||||
(\acc (Entity _ sheetcorr@SheetCorrector{sheetCorrectorSheet}, Entity uid user) ->
|
||||
let shn = sheetName $ sheets ! sheetCorrectorSheet
|
||||
in Map.insertWith (\(usr, ma) (_, mb) -> (usr, Map.union ma mb)) uid (user, Map.singleton shn sheetcorr) acc
|
||||
)
|
||||
|
||||
submissions <- E.select . E.from $ \submission -> do
|
||||
E.where_ $ submission E.^. SubmissionSheet `E.in_` E.valList sheetIds
|
||||
|
||||
@ -130,6 +130,16 @@
|
||||
<td .table__th>#{getLoadSum shn}
|
||||
<td .table__th>#{ciSubmissions}
|
||||
<td .table__td colspan=3>^{simpleLinkI (SomeMessage MsgMenuCorrectorsChange) (CSheetR tid ssh csh shn SCorrR)}
|
||||
|
||||
<tr .table__row .table__row--head>
|
||||
<th>
|
||||
<th colspan=2>
|
||||
<th>
|
||||
<th colspan=3>
|
||||
$# Always iterate over orderedSheetNames for consistent sorting! Newest first, except in this table
|
||||
$forall shn <- orderedSheetNames
|
||||
<th .table__th colspan=5>#{shn}
|
||||
|
||||
^{btnWdgt}
|
||||
<div>
|
||||
<p>_{MsgAssignSubmissionsRandomWarning}
|
||||
Loading…
Reference in New Issue
Block a user