handle is_anonymous

This commit is contained in:
Filip Gralinski 2016-02-14 08:59:12 +01:00
parent 92af354a88
commit cf55550453
4 changed files with 11 additions and 7 deletions

View File

@ -175,7 +175,7 @@ instance YesodAuth App where
, userName = Nothing , userName = Nothing
, userIsAdmin = False , userIsAdmin = False
, userLocalId = Nothing , userLocalId = Nothing
, userIsAnonymous = Just False , userIsAnonymous = False
} }
-- You can add other plugins like BrowserID, email or OAuth here -- You can add other plugins like BrowserID, email or OAuth here

View File

@ -124,7 +124,7 @@ getSubmission repoId commit challengeId description chan = do
submissionDescription=description, submissionDescription=description,
submissionStamp=time, submissionStamp=time,
submissionSubmitter=userId, submissionSubmitter=userId,
submissionIsPublic=Just False } submissionIsPublic=False }
getOuts :: Channel -> Key Submission -> Handler ([Out]) getOuts :: Channel -> Key Submission -> Handler ([Out])
getOuts chan submissionId = do getOuts chan submissionId = do

View File

@ -107,9 +107,13 @@ getEvaluationMap s@(Entity submissionId submission) = do
formatSubmitter :: User -> Text formatSubmitter :: User -> Text
formatSubmitter user = case userName user of formatSubmitter user = if userIsAnonymous user
Just name -> name then
Nothing -> "[name not given]" "[anonymised]"
else
case userName user of
Just name -> name
Nothing -> "[name not given]"
submissionScore :: Key Test -> (Entity Submission, Entity User, Map (Key Test) Evaluation) -> String submissionScore :: Key Test -> (Entity Submission, Entity User, Map (Key Test) Evaluation) -> String
submissionScore k (_, _, m) = fromMaybe "N/A" (presentScore <$> lookup k m) submissionScore k (_, _, m) = fromMaybe "N/A" (presentScore <$> lookup k m)

View File

@ -5,7 +5,7 @@ User
name Text Maybe name Text Maybe
isAdmin Bool default=False isAdmin Bool default=False
localId Text Maybe localId Text Maybe
isAnonymous Bool Maybe isAnonymous Bool default=False
deriving Typeable deriving Typeable
PublicKey PublicKey
user UserId user UserId
@ -47,7 +47,7 @@ Submission
description Text description Text
stamp UTCTime default=now() stamp UTCTime default=now()
submitter UserId submitter UserId
isPublic Bool Maybe isPublic Bool default=False
UniqueSubmissionRepoCommitChallenge repo commit challenge UniqueSubmissionRepoCommitChallenge repo commit challenge
Fork Fork
source SubmissionId source SubmissionId