From 69349fed2e3a41be9a8052c6462525014cb76fc0 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 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/jobs/trophy_job.rb b/app/jobs/trophy_job.rb index cdd7c09b..0f9eadcc 100644 --- a/app/jobs/trophy_job.rb +++ b/app/jobs/trophy_job.rb @@ -4,8 +4,15 @@ 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| + next if trigger.conditions.empty? trigger.perform(profile, 'trophy') end + rescue Trigger::TriggerError => e + Rails.logger.error(e) + raise e + rescue StandardError => e + Rails.logger.error(e) + raise e end end