Skip to content

Commit

Permalink
Fix Sentry issues (#1768)
Browse files Browse the repository at this point in the history
* CV2-3519: sentry issue

* CV2-3947: sentry issue

* CV2-4035: sentry issue

* CV2-4102: sentry issue

* CV2-4135: sentry issue
  • Loading branch information
melsawy authored Dec 28, 2023
1 parent 4d7301c commit 4e107b7
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion app/models/bot_user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def settings_as_json_schema(validate = false, team_slug = nil)
unless validate
if s[:name] == 'smooch_template_locales'
team = Team.find_by_slug(team_slug)
default = team.default_language
default = team&.default_language
properties[s[:name]].merge!({ uniqueItems: true, default: default, items: { type: 'string', enum: Bot::Smooch.template_locale_options(team_slug) } })
end
if s[:name] == 'smooch_workflows'
Expand Down
8 changes: 4 additions & 4 deletions app/models/concerns/alegre_v2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def get_type(project_media)
elsif project_media.is_audio?
type = 'audio'
end
return type
type
end

def generic_package(project_media, field)
Expand Down Expand Up @@ -193,9 +193,9 @@ def delete(project_media, field=nil, params={})
def get_per_model_threshold(project_media, threshold)
type = get_type(project_media)
if type == "text"
{per_model_threshold: threshold.collect{|x| {model: x[:model], value: x[:value]}}}
{ per_model_threshold: threshold&.collect{ |x| { model: x[:model], value: x[:value] } } }
else
{threshold: threshold[0][:value]}
{ threshold: threshold&.dig(0, :value) }
end
end

Expand Down Expand Up @@ -224,7 +224,7 @@ def parse_similarity_results(project_media, field, results, relationship_type)
relationship_type: relationship_type
}
]
}.reject{|k,_| k == project_media.id}]
}.reject{ |k,_| k == project_media.id }]
end

def get_items(project_media, field, confirmed=false)
Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/annotation_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def annotated_is_not_archived

def propagate_assignment_to(user)
if self.annotation_type == 'verification_status'
self.annotated.get_annotations('task').map(&:load).select{ |task| task.responses.count == 0 || task.responses.select{ |r| r.annotator_id.to_i == user&.id }.last.nil? }
self.annotated.get_annotations('task').map(&:load).reject{ |task| task.nil? }.select{ |task| task.responses.count == 0 || task.responses.select{ |r| r.annotator_id.to_i == user&.id }.last.nil? }
else
[]
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/project_media_creators.rb
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,6 @@ def create_claim_description_and_fact_check
end

def create_tags
self.set_tags.each { |tag| Tag.create!(annotated: self, tag: tag, skip_check_ability: true) } unless self.set_tags.blank?
self.set_tags.each { |tag| Tag.create!(annotated: self, tag: tag, skip_check_ability: true) } if self.set_tags.is_a?(Array)
end
end
2 changes: 1 addition & 1 deletion lib/tasks/data/fetch.rake
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace :check do
task print_status_mapping: :environment do |_t, args|
data = parse_args args.extras
slug = data['slug']
services = data['services'].split('|')
services = data['services']&.split('|')
print_status_mapping(services, Team.where(slug: slug).first)
end

Expand Down

0 comments on commit 4e107b7

Please sign in to comment.