Skip to content

Commit

Permalink
Added support for unnecessary results
Browse files Browse the repository at this point in the history
  • Loading branch information
rapind committed Nov 27, 2024
1 parent b05932a commit f82b15b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion prod.min.js

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions src/Results.elm
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ type SideResult
= SideResultWon
| SideResultLost
| SideResultTied
| SideResultUnplayed
| SideResultUnnecessary
| SideResultConceded
| SideResultForfeited
| SideResultTimePenalized
Expand Down Expand Up @@ -850,8 +850,8 @@ decodeGame =
"tied" ->
Decode.succeed (Just SideResultTied)

"unplayed" ->
Decode.succeed (Just SideResultUnplayed)
"unnecessary" ->
Decode.succeed (Just SideResultUnnecessary)

"conceded" ->
Decode.succeed (Just SideResultForfeited)
Expand Down Expand Up @@ -1052,8 +1052,8 @@ sideResultToString translations result =
Just SideResultTied ->
"tied"

Just SideResultUnplayed ->
"unplayed"
Just SideResultUnnecessary ->
"unnecessary"

Just SideResultConceded ->
"forfeited"
Expand Down Expand Up @@ -1656,7 +1656,7 @@ gameScore game orderByTeamIds =
Just SideResultTied ->
"T"

Just SideResultUnplayed ->
Just SideResultUnnecessary ->
"U"

_ ->
Expand Down Expand Up @@ -3512,11 +3512,11 @@ viewDraws theme translations eventConfig event =
tied =
List.any (\s -> s.result == Just SideResultTied) game.sides

unplayed =
List.any (\s -> s.result == Just SideResultUnplayed) game.sides
unnecessary =
List.any (\s -> s.result == Just SideResultUnnecessary) game.sides

sortedTeamNames =
if tied || unplayed then
if tied || unnecessary then
List.map teamNameForSide game.sides
|> List.filterMap identity

Expand Down Expand Up @@ -4358,9 +4358,9 @@ viewGame theme translations eventConfig event sheetLabel detailed draw game =
GamePending ->
text (translate translations "upcoming_game" ++ ": " ++ game.name)
in
if List.any (\s -> s.result == Just SideResultUnplayed) game.sides then
-- Unplayed games are never linked.
el [ Font.italic, Font.color theme.greyDark, El.padding 8 ] (text (translate translations "unplayed"))
if List.any (\s -> s.result == Just SideResultUnnecessary) game.sides then
-- Unnecessary games are never linked.
el [ Font.italic, Font.color theme.greyDark, El.padding 8 ] (text (translate translations "unnecessary"))

else if detailed then
el [ Font.italic, Font.color theme.greyDark, El.padding 8 ] label
Expand Down

0 comments on commit f82b15b

Please sign in to comment.