From d341c13721cce1a4aa45e69887a1fb853d90a12e Mon Sep 17 00:00:00 2001 From: kinoppyd Date: Tue, 14 May 2024 18:20:54 +0900 Subject: [PATCH] Skip empty condition trigger, there is QR trigger. --- app/jobs/trophy_job.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/jobs/trophy_job.rb b/app/jobs/trophy_job.rb index cdd7c09b..3c2baadc 100644 --- a/app/jobs/trophy_job.rb +++ b/app/jobs/trophy_job.rb @@ -4,8 +4,14 @@ class TrophyJob < ApplicationJob queue_as :default def perform(profile) - Trigger.where('description LIKE ?', 'trophy:%').each do |trigger| + Trigger.where('description LIKE ?', 'trophy:%').order(description: :asc).each do |trigger| + logger.info("Trigger: #{trigger.description}") + next if trigger.conditions.empty? + trigger.perform(profile, 'trophy') end + rescue Trigger::TriggerError, StandardError => e + logger.error(e) + raise e end end