Class: Collavre::Task
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- ApplicationRecord
- Collavre::Task
- Defined in:
- app/models/collavre/task.rb
Class Method Summary collapse
-
.duplicate_running_for_comment?(agent_id, comment_id) ⇒ Boolean
Check if agent already has a running task triggered by the same comment.
Class Method Details
.duplicate_running_for_comment?(agent_id, comment_id) ⇒ Boolean
Check if agent already has a running task triggered by the same comment
29 30 31 32 33 34 35 |
# File 'app/models/collavre/task.rb', line 29 def self.duplicate_running_for_comment?(agent_id, comment_id) where(agent_id: agent_id, status: "running", trigger_event_name: "comment_created") .find_each do |task| return true if task.trigger_event_payload&.dig("comment", "id").to_s == comment_id.to_s end false end |