Variant information reachable from query results

This commit is contained in:
Filip Gralinski 2019-11-30 11:25:53 +01:00
parent c0a06ae112
commit 1d2c2ca78f
3 changed files with 11 additions and 3 deletions

View File

@ -100,9 +100,10 @@ getViewVariantR variantId = do
let theSubmissionId = variantSubmission variant let theSubmissionId = variantSubmission variant
theSubmission <- runDB $ get404 theSubmissionId theSubmission <- runDB $ get404 theSubmissionId
([entry], tests) <- runDB $ getChallengeSubmissionInfos (\e -> entityKey e == theSubmissionId) ([entry], tests') <- runDB $ getChallengeSubmissionInfos (\e -> entityKey e == theSubmissionId)
(\e -> entityKey e == variantId) (\e -> entityKey e == variantId)
(submissionChallenge theSubmission) (submissionChallenge theSubmission)
let tests = sortBy (flip testComparator) tests'
if submissionIsPublic theSubmission || Just (submissionSubmitter theSubmission) == (entityKey <$> mauthId) if submissionIsPublic theSubmission || Just (submissionSubmitter theSubmission) == (entityKey <$> mauthId)
then then

View File

@ -82,6 +82,11 @@ variantTable paramNames tests = mempty
++ Table.int "#" tableEntryRank ++ Table.int "#" tableEntryRank
++ mconcat (map paramExtractor paramNames) ++ mconcat (map paramExtractor paramNames)
++ mconcat (map (\e@(Entity _ t) -> resultCell t (extractScore $ getTestReference e)) tests) ++ mconcat (map (\e@(Entity _ t) -> resultCell t (extractScore $ getTestReference e)) tests)
++ Table.widget "" variantStatusCellWidget
variantStatusCellWidget :: TableEntry -> WidgetFor App ()
variantStatusCellWidget entry = $(widgetFile "variant-status")
where theVariantId = entityKey $ tableEntryVariant entry
paramExtractor :: Text -> Table App TableEntry paramExtractor :: Text -> Table App TableEntry
paramExtractor paramName = Table.text paramName (\entry -> paramExtractor paramName = Table.text paramName (\entry ->

View File

@ -0,0 +1,2 @@
<a href="@{ViewVariantR theVariantId}">
<span class="glyphicon glyphicon-info-sign" title="click to see the detailed information" aria-hidden="true">