Skip to content

Commit

Permalink
fix: don't resubmit puzzles
Browse files Browse the repository at this point in the history
When a puzzle was already submitted, and a new implementation was tried but that implementation gave the wrong answer, then the puzzle was tried to submit again.
This fix prevents that.
  • Loading branch information
Peter van der Wal committed Dec 22, 2024
1 parent 65c8fbb commit c376cfd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/Service/AnswerService.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ public function __construct(
*/
public function isCorrectAnswer(int $year, int $day, int $part, int|string $answer): ?bool
{
if ((string)$answer === $this->getSubmittedAnswer($year, $day, $part)) {
return true;
$submittedAnswer = $this->getSubmittedAnswer($year, $day, $part);
if ($submittedAnswer !== null) {
return (string)$answer === $submittedAnswer;
}
if (in_array($answer, $this->getKnownWrongAnswers($year, $day, $part), true)) {
return false;
Expand Down

0 comments on commit c376cfd

Please sign in to comment.