Skip to content

Commit

Permalink
Cover one more untagged annul reason, premature timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
anoek committed Oct 25, 2023
1 parent 3788358 commit b735703
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/views/Game/PlayControls.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,11 @@ export function PlayControls({
<AnnulmentReason
reason={
annulment_reason ||
(engine.outcome === "Cancellation" ? { cancellation: true } : null)
(engine.outcome === "Cancellation" ? { cancellation: true } : null) ||
(engine.outcome === "Timeout" &&
engine.last_official_move.move_number < 20
? { premature_timeout: true }
: null)
}
/>
)}
Expand Down Expand Up @@ -1316,7 +1320,7 @@ function currentPlayer(goban: Goban): number {
function AnnulmentReason({
reason,
}: null | {
reason: rest_api.AnnulmentReason | { cancellation: true };
reason: rest_api.AnnulmentReason | { cancellation?: true; premature_timeout?: true };
}): JSX.Element {
if (!reason) {
return null;
Expand Down Expand Up @@ -1363,6 +1367,13 @@ function AnnulmentReason({
case "cancellation":
arr.push(<div key={key}>{_("The game was canceled so will not be rated.")}</div>);
break;
case "premature_timeout":
arr.push(
<div key={key}>
{_("Not enough moves were made for this game to be rated.")}
</div>,
);
break;
default:
arr.push(<div key={key}>{key}</div>);
break;
Expand Down

0 comments on commit b735703

Please sign in to comment.