Skip to content

Commit

Permalink
CV2-6040: use attr_accessor
Browse files Browse the repository at this point in the history
  • Loading branch information
melsawy committed Feb 7, 2025
1 parent 23210b1 commit 85955f1
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
3 changes: 2 additions & 1 deletion app/models/annotations/dynamic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class DuplicateFieldError < ActiveRecord::RecordNotUnique; end
mount_uploaders :file, ImageUploader
serialize :file, JSON

attr_accessor :set_fields, :set_attribution, :action, :action_data
attr_accessor :set_fields, :set_attribution, :action, :action_data, :bypass_status_publish_check

belongs_to :annotation_type_object, class_name: 'DynamicAnnotation::AnnotationType', foreign_key: 'annotation_type', primary_key: 'annotation_type', optional: true
has_many :fields, class_name: 'DynamicAnnotation::Field', foreign_key: 'annotation_id', primary_key: 'id', dependent: :destroy
Expand Down Expand Up @@ -235,6 +235,7 @@ def update_fields
next if value.blank?
f = fields.select{ |x| x.field_name == field }.last || create_field(field, nil)
f.value = value
f.bypass_status_publish_check = self.bypass_status_publish_check
f.skip_check_ability = self.skip_check_ability unless self.skip_check_ability.nil?
begin
f.save!
Expand Down
2 changes: 1 addition & 1 deletion app/models/dynamic_annotation/field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ class DynamicAnnotation::Field < ApplicationRecord
include CheckElasticSearch
has_paper_trail on: [:create, :update], save_changes: true, ignore: [:updated_at, :created_at], if: proc { |f| User.current.present? && (['verification_status_status', 'team_bot_response_formatted_data', 'language'].include?(f.field_name) || f.annotation_type == 'archiver' || f.annotation_type =~ /^task_response/) }, versions: { class_name: 'Version' }

attr_accessor :disable_es_callbacks
attr_accessor :disable_es_callbacks, :bypass_status_publish_check

belongs_to :annotation, optional: true
belongs_to :annotation_type_object, class_name: 'DynamicAnnotation::AnnotationType', foreign_key: 'annotation_type', primary_key: 'annotation_type', optional: true
Expand Down
2 changes: 1 addition & 1 deletion app/models/workflow/verification_status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def apply_rules
end

def check_if_item_is_published
return if RequestStore.store[:bypass_status_publish_check]
return if self.bypass_status_publish_check
published = begin (self.annotation.annotated.get_annotations('report_design').last.load.get_field_value('state') == 'published') rescue false end
if published
error = {
Expand Down
3 changes: 1 addition & 2 deletions test/models/bot/smooch_2_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,9 @@ def teardown
s.save!
publish_report(pm_t)
s = s.reload
RequestStore.store[:bypass_status_publish_check] = true
s.status = 'in_progress'
s.bypass_status_publish_check = true
s.save!
RequestStore.store[:bypass_status_publish_check] = false
assert_equal 'in_progress', s.reload.status
end

Expand Down

0 comments on commit 85955f1

Please sign in to comment.