Skip to content

Commit

Permalink
updates confirmation enum values: from 'true' to 'correct'; from 'fal…
Browse files Browse the repository at this point in the history
…se' to 'incorrect'
  • Loading branch information
andrew-1234 committed Feb 7, 2025
1 parent a8c0762 commit 8a01ae2
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions app/models/verification.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class Verification < ApplicationRecord
belongs_to :updater, class_name: 'User', inverse_of: :updated_verifications, optional: true

# Defines the possible values for confirmation
CONFIRMATION_TRUE = 'true'
CONFIRMATION_FALSE = 'false'
CONFIRMATION_TRUE = 'correct'
CONFIRMATION_FALSE = 'incorrect'
CONFIRMATION_UNSURE = 'unsure'
CONFIRMATION_SKIP = 'skip'

Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20250120064731_create_verifications.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class CreateVerifications < ActiveRecord::Migration[7.2]
def change
create_enum :confirmation, ['true', 'false', 'unsure', 'skip']
create_enum :confirmation, ['correct', 'incorrect', 'unsure', 'skip']

create_table :verifications do |t|
t.references :audio_event, null: false, foreign_key: { on_delete: :cascade }
Expand Down
4 changes: 2 additions & 2 deletions db/structure.sql
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ CREATE TYPE public.analysis_jobs_item_transition AS ENUM (
--

CREATE TYPE public.confirmation AS ENUM (
'true',
'false',
'correct',
'incorrect',
'unsure',
'skip'
);
Expand Down
4 changes: 2 additions & 2 deletions spec/api/verifications_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
send_model do
{
'verification' => {
confirmed: 'false'
confirmed: Verification::CONFIRMATION_FALSE
}
}
end
Expand All @@ -87,7 +87,7 @@
send_model do
{
'verification' => {
confirmed: 'false'
confirmed: Verification::CONFIRMATION_FALSE
}
}
end
Expand Down
4 changes: 2 additions & 2 deletions spec/permissions/verifications_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@
send_update_body do
[{
'verification' => {
confirmed: 'false'
confirmed: Verification::CONFIRMATION_FALSE
}
}, :json]
end

send_create_body do
[{
'verification' => {
confirmed: 'true',
confirmed: Verification::CONFIRMATION_TRUE,
audio_event_id: audio_event.id,
tag_id: create(:tag).id
}
Expand Down
10 changes: 5 additions & 5 deletions spec/requests/verifications_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@
create_entire_hierarchy

before do
create(:verification, audio_event:, creator: owner_user, confirmed: 'true')
create(:verification, audio_event:, creator: writer_user, confirmed: 'false')
create(:verification, audio_event:, creator: owner_user, confirmed: Verification::CONFIRMATION_TRUE)
create(:verification, audio_event:, creator: writer_user, confirmed: Verification::CONFIRMATION_FALSE)
end

it 'can filter verifications by confirmed status' do
filter = {
filter: {
confirmed: { eq: 'true' }
confirmed: { eq: Verification::CONFIRMATION_TRUE }
}
}
get '/verifications/filter', params: filter, **api_headers(writer_token)

expect(response).to have_http_status(:ok)
expect_number_of_items(2)
expect(api_data).to include(a_hash_including(confirmed: 'true'))
expect(api_data).to include(a_hash_including(confirmed: Verification::CONFIRMATION_TRUE))
end

it 'can filter verifications by creator' do
Expand Down Expand Up @@ -56,7 +56,7 @@
verification: {
tag_id: tag.id,
audio_event_id: audio_event.id,
confirmed: 'true'
confirmed: Verification::CONFIRMATION_TRUE
}
}
}
Expand Down

0 comments on commit 8a01ae2

Please sign in to comment.