Skip to content

Commit

Permalink
Change answer-checking to be more forgiving
Browse files Browse the repository at this point in the history
  • Loading branch information
backspace committed Jul 21, 2024
1 parent 253b653 commit 64deb18
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion waydowntown/waydowntown_server/app/models/answer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def game_cannot_have_winner
def check_for_winner
answer_found = false

answer_found = true if game.incarnation.answer == answer
answer_found = true if game&.incarnation&.answer&.casecmp?(answer.strip)

yield answer

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{
data: {
type: 'answers',
attributes: attributes_for(:answer, answer: incarnation.answer),
attributes: attributes_for(:answer, answer: " #{incarnation.answer.upcase} "),
relationships: {
game: {
data: {
Expand All @@ -28,7 +28,7 @@
described_class.build(payload)
end

describe 'when a game does not have a winning answer and the new answer is correct' do
describe 'when a game does not have a winning answer and the new answer is case-insensitive correct' do
before do
answer.save
game.reload
Expand Down

0 comments on commit 64deb18

Please sign in to comment.