refactor(fixed-submission-groups): cleanup stub
This commit is contained in:
parent
a2e9a9c32d
commit
94d3e00bbc
@ -23,12 +23,9 @@ SubmissionUser -- which submission belongs to whom
|
|||||||
UniqueSubmissionUser user submission -- multiple users may share same submission, in case of (ad-hoc) submission groups
|
UniqueSubmissionUser user submission -- multiple users may share same submission, in case of (ad-hoc) submission groups
|
||||||
SubmissionGroup -- pre-defined submission groups; some courses only allow pre-defined submission groups
|
SubmissionGroup -- pre-defined submission groups; some courses only allow pre-defined submission groups
|
||||||
course CourseId
|
course CourseId
|
||||||
name Text Maybe
|
name SubmissionGroupName
|
||||||
SubmissionGroupEdit -- who edited a submissionGroup when?
|
UniqueSubmissionGroup course name
|
||||||
user UserId
|
|
||||||
time UTCTime
|
|
||||||
submissionGroup SubmissionGroupId
|
|
||||||
SubmissionGroupUser -- Registered submission groups, just for checking upon submission, but independent of actual SubmissionUser
|
SubmissionGroupUser -- Registered submission groups, just for checking upon submission, but independent of actual SubmissionUser
|
||||||
submissionGroup SubmissionGroupId
|
submissionGroup SubmissionGroupId
|
||||||
user UserId
|
user UserId
|
||||||
UniqueSubmissionGroupUser submissionGroup user
|
UniqueSubmissionGroupUser submissionGroup user
|
||||||
|
|||||||
@ -592,18 +592,11 @@ mkSubmissionGroupTable =
|
|||||||
, course E.^. CourseSchool
|
, course E.^. CourseSchool
|
||||||
, course E.^. CourseShorthand
|
, course E.^. CourseShorthand
|
||||||
)
|
)
|
||||||
return (crse, sgroup, lastSGEdit sgroup)
|
return (crse, sgroup)
|
||||||
dbtRowKey (_ `E.InnerJoin` sgroup `E.InnerJoin` _) = sgroup E.^. SubmissionGroupId
|
dbtRowKey (_ `E.InnerJoin` sgroup `E.InnerJoin` _) = sgroup E.^. SubmissionGroupId
|
||||||
|
|
||||||
lastSGEdit sgroup = -- latest Edit-Time of this Submission Group by a user
|
|
||||||
E.subSelectMaybe . E.from $ \(user `E.InnerJoin` sgEdit) -> do
|
|
||||||
E.on $ user E.^. UserId E.==. sgEdit E.^. SubmissionGroupEditUser
|
|
||||||
E.where_ $ sgEdit E.^. SubmissionGroupEditSubmissionGroup E.==. sgroup E.^. SubmissionGroupId
|
|
||||||
return . E.max_ $ sgEdit E.^. SubmissionGroupEditTime
|
|
||||||
|
|
||||||
dbtProj x = return $ x
|
dbtProj x = return $ x
|
||||||
& _dbrOutput . _1 %~ (\(E.Value tid, E.Value ssh, E.Value csh) -> (tid,ssh,csh))
|
& _dbrOutput . _1 %~ $(E.unValueN 3)
|
||||||
& _dbrOutput . _3 %~ E.unValue
|
|
||||||
|
|
||||||
dbtColonnade = mconcat
|
dbtColonnade = mconcat
|
||||||
[ sortable (Just "term") (i18nCell MsgTerm) $
|
[ sortable (Just "term") (i18nCell MsgTerm) $
|
||||||
@ -614,21 +607,15 @@ mkSubmissionGroupTable =
|
|||||||
, sortable (Just "course") (i18nCell MsgCourse) $
|
, sortable (Just "course") (i18nCell MsgCourse) $
|
||||||
courseCellCL <$> view (_dbrOutput . _1)
|
courseCellCL <$> view (_dbrOutput . _1)
|
||||||
, sortable (Just "submissiongroup") (i18nCell MsgSubmissionGroupName) . magnify (_dbrOutput . _2 . _entityVal) $
|
, sortable (Just "submissiongroup") (i18nCell MsgSubmissionGroupName) . magnify (_dbrOutput . _2 . _entityVal) $
|
||||||
maybe mempty textCell <$> view _submissionGroupName
|
cell . views _submissionGroupName toWidget
|
||||||
, sortable (Just "edit") (i18nCell MsgLastEdit) $
|
|
||||||
maybe mempty dateTimeCell <$> view (_dbrOutput . _3)
|
|
||||||
]
|
]
|
||||||
|
|
||||||
validator = def -- DUPLICATED CODE: Handler.Corrections
|
validator = def & defaultSorting [SortDescBy "term", SortAscBy "school", SortAscBy "course"]
|
||||||
& restrictFilter (\name _ -> name /= "corrector") -- We need to be careful to restrict allowed sorting/filter to not expose sensitive information
|
|
||||||
& restrictSorting (\name _ -> name /= "corrector")
|
|
||||||
& defaultSorting [SortDescBy "edit"]
|
|
||||||
dbtSorting = Map.fromList
|
dbtSorting = Map.fromList
|
||||||
[ ( "course", SortColumn $ withType $ \(crse `E.InnerJoin` _ `E.InnerJoin` _ ) -> crse E.^. CourseShorthand)
|
[ ( "course", SortColumn $ withType $ \(crse `E.InnerJoin` _ `E.InnerJoin` _ ) -> crse E.^. CourseShorthand)
|
||||||
, ( "term" , SortColumn $ withType $ \(crse `E.InnerJoin` _ `E.InnerJoin` _ ) -> crse E.^. CourseTerm )
|
, ( "term" , SortColumn $ withType $ \(crse `E.InnerJoin` _ `E.InnerJoin` _ ) -> crse E.^. CourseTerm )
|
||||||
, ( "school", SortColumn $ withType $ \(crse `E.InnerJoin` _ `E.InnerJoin` _ ) -> crse E.^. CourseSchool )
|
, ( "school", SortColumn $ withType $ \(crse `E.InnerJoin` _ `E.InnerJoin` _ ) -> crse E.^. CourseSchool )
|
||||||
, ( "submissiongroup" , SortColumn $ withType $ \(_ `E.InnerJoin` sgroup `E.InnerJoin` _) -> sgroup E.^. SubmissionGroupName )
|
, ( "submissiongroup" , SortColumn $ withType $ \(_ `E.InnerJoin` sgroup `E.InnerJoin` _) -> sgroup E.^. SubmissionGroupName )
|
||||||
, ( "edit" , SortColumn $ withType $ \(_ `E.InnerJoin` sgroup `E.InnerJoin` _ ) -> lastSGEdit sgroup)
|
|
||||||
]
|
]
|
||||||
dbtFilter = Map.fromList
|
dbtFilter = Map.fromList
|
||||||
[ ( "course", FilterColumn $ withType $ \(crse `E.InnerJoin` _ `E.InnerJoin` _) -> emptyOrIn $ crse E.^. CourseShorthand)
|
[ ( "course", FilterColumn $ withType $ \(crse `E.InnerJoin` _ `E.InnerJoin` _) -> emptyOrIn $ crse E.^. CourseShorthand)
|
||||||
|
|||||||
@ -632,6 +632,13 @@ customMigrations = Map.fromListWith (>>)
|
|||||||
, whenM (tableExists "allocation_matching") $
|
, whenM (tableExists "allocation_matching") $
|
||||||
tableDropEmpty "allocation_matching"
|
tableDropEmpty "allocation_matching"
|
||||||
)
|
)
|
||||||
|
, ( AppliedMigrationKey [migrationVersion|34.0.0|] [version|35.0.0|]
|
||||||
|
, do
|
||||||
|
whenM (tableExists "submission_group") $
|
||||||
|
tableDropEmpty "submission_group"
|
||||||
|
whenM (tableExists "submission_group_edit") $
|
||||||
|
tableDropEmpty "submission_group_edit"
|
||||||
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -47,6 +47,8 @@ type ExamOccurrenceName = CI Text
|
|||||||
type AllocationName = CI Text
|
type AllocationName = CI Text
|
||||||
type AllocationShorthand = CI Text
|
type AllocationShorthand = CI Text
|
||||||
|
|
||||||
|
type SubmissionGroupName = CI Text
|
||||||
|
|
||||||
type PWHashAlgorithm = ByteString -> PWStore.Salt -> Int -> ByteString
|
type PWHashAlgorithm = ByteString -> PWStore.Salt -> Int -> ByteString
|
||||||
type InstanceId = UUID
|
type InstanceId = UUID
|
||||||
type ClusterId = UUID
|
type ClusterId = UUID
|
||||||
|
|||||||
Reference in New Issue
Block a user