Skip to content

Commit

Permalink
fix: DAH-3181 Handle invalid listings when logging translation usage (#…
Browse files Browse the repository at this point in the history
…2510)

fix: handle invalid listings when logging translation usage
  • Loading branch information
jimlin-sfgov authored Jan 22, 2025
1 parent 5af3025 commit f3905af
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/services/force/listing_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def self.listing(id, opts = {})
results = Request.new(parse_response: true).cached_get(endpoint, nil, force)
listing = process_listing_images(results)

translation_usage_by_trigger(listing, opts[:rake_task])
translation_usage_by_trigger(listing, opts[:rake_task]) if listing.present?

if Rails.configuration.unleash.is_enabled? 'GoogleCloudTranslate'
listing['translations'] = get_listing_translations(listing) || {}
Expand All @@ -51,7 +51,7 @@ def self.listing(id, opts = {})
def self.translation_usage_by_trigger(listing, rake_task = nil)
# only one of these feature flags should be turned on at a time
if Rails.configuration.unleash.is_enabled?(
'LogGoogleCloudTranslateUsageForPageView'
'LogGoogleCloudTranslateUsageForPageView',
) && rake_task.blank?
listing['translations'] = log_listing_translations(listing, 'page_view')
elsif Rails.configuration.unleash.is_enabled?(
Expand Down

0 comments on commit f3905af

Please sign in to comment.