Skip to content

Commit

Permalink
debug(survey): back to sent IS NOT true
Browse files Browse the repository at this point in the history
  • Loading branch information
chillfox committed Feb 21, 2024
1 parent 59ca375 commit 711686c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
2 changes: 1 addition & 1 deletion spec/survey_invitation_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module PlaceOS::Model
surveys.first.id.should eq invitation_one.id
end

it "lists invitations with sent != true", focus: true do
it "lists invitations with sent != true" do
invitation_one = Generator.invitation(sent: true).save!

Check warning on line 42 in spec/survey_invitation_spec.cr

View workflow job for this annotation

GitHub Actions / Ameba

Lint/UselessAssign

Useless assignment to variable `invitation_one`
Raw output
> invitation_one = Generator.invitation(sent: true).save!
  ^
invitation_two = Generator.invitation(sent: false).save!
invitation_three = Generator.invitation(sent: nil).save!
Expand Down
5 changes: 1 addition & 4 deletions src/placeos-models/survey/invitation.cr
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,7 @@ module PlaceOS::Model
query = query.where(survey_id: survey_id) if survey_id
# can't use `query.where_not(sent: true)` here due to
# sent <> true` not being equivalent to `sent IS NOT true` in PostgreSQL
query = sent ? query.where(sent: true) : query.where("sent IS NOT ?", true) unless sent.nil?
pp "================================================================================"
pp query.to_sql
pp "================================================================================"
query = sent ? query.where(sent: true) : query.where("sent IS NOT true") unless sent.nil?
query.to_a
end

Expand Down

0 comments on commit 711686c

Please sign in to comment.