2023-07-09 22:06:40 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
module Jobs
|
|
|
|
class CheckTranslationOverrides < ::Jobs::Scheduled
|
|
|
|
every 1.day
|
|
|
|
|
|
|
|
def execute(args)
|
2023-07-14 04:52:39 -04:00
|
|
|
deprecated_ids = []
|
2023-07-09 22:06:40 -04:00
|
|
|
invalid_ids = []
|
|
|
|
outdated_ids = []
|
|
|
|
|
|
|
|
TranslationOverride.find_each do |override|
|
2023-07-14 04:52:39 -04:00
|
|
|
if override.original_translation_deleted?
|
|
|
|
deprecated_ids << override.id
|
|
|
|
elsif override.invalid_interpolation_keys.present?
|
2023-07-09 22:06:40 -04:00
|
|
|
invalid_ids << override.id
|
|
|
|
elsif override.original_translation_updated?
|
|
|
|
outdated_ids << override.id
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-07-14 04:52:39 -04:00
|
|
|
TranslationOverride.where(id: deprecated_ids).update_all(status: "deprecated")
|
2023-07-09 22:06:40 -04:00
|
|
|
TranslationOverride.where(id: outdated_ids).update_all(status: "outdated")
|
|
|
|
TranslationOverride.where(id: invalid_ids).update_all(status: "invalid_interpolation_keys")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|