feat(exam-correct): add hasMore to no-op reponse

This commit is contained in:
Sarah Vaupel 2020-08-12 16:13:25 +02:00
parent d4d27f8ef6
commit e941083a44
3 changed files with 7 additions and 4 deletions

View File

@ -98,9 +98,10 @@ postECorrectR tid ssh csh examn = do
if
-- on no-op request, answer with 200 and a set of all participant matches
| is _Nothing ciqResults, is _Nothing ciqGrade -> do
users <- traverse userToResponse participantMatches
users <- traverse userToResponse $ take maxCountUserMatches participantMatches
return CorrectInterfaceResponseNoOp
{ cirnUsers = Set.fromList users
{ cirnUsers = Set.fromList users
, cirnHasMore = length participantMatches > maxCountUserMatches
}
-- on match with exactly one exam participant, insert results and/or grade and answer with 200

View File

@ -93,9 +93,10 @@ postEECorrectR tid ssh coursen examn = do
if
| is _Nothing ciqResults, is _Nothing ciqGrade -> do
users <- traverse userToResponse matches
users <- traverse userToResponse $ take maxCountUserMatches matches
return CorrectInterfaceResponseNoOp
{ cirnUsers = Set.fromList users
{ cirnUsers = Set.fromList users
, cirnHasMore = length matches > maxCountUserMatches
}
| [match@(Entity uid _)] <- matches -> do
now <- liftIO getCurrentTime

View File

@ -51,6 +51,7 @@ data CorrectInterfaceResponse
}
| CorrectInterfaceResponseNoOp
{ cirnUsers :: Set CorrectInterfaceUser
, cirnHasMore :: Bool
}
deriveToJSON defaultOptions