app/models/naf/historical_job.rb in naf-2.0.4 vs app/models/naf/historical_job.rb in naf-2.1.0

- old
+ new

@@ -13,10 +13,11 @@ include PgAdvisoryLocker # Protect from mass-assignment issue attr_accessible :application_id, + :application_schedule_id, :application_type_id, :command, :application_run_group_restriction_id, :application_run_group_name, :application_run_group_limit, @@ -42,10 +43,12 @@ #--------------------- # *** Associations *** #+++++++++++++++++++++ + belongs_to :application_schedule, + class_name: '::Naf::ApplicationSchedule' belongs_to :application_type, class_name: '::Naf::ApplicationType' belongs_to :started_on_machine, class_name: '::Naf::Machine', foreign_key: 'started_on_machine_id' @@ -173,12 +176,12 @@ def self.canceled where(request_to_terminate: true) end def self.application_last_runs - where("application_id IS NOT NULL"). - group("application_id"). - select("application_id, MAX(finished_at) AS finished_at"). + where("application_schedule_id IS NOT NULL"). + group("application_schedule_id"). + select("application_schedule_id, MAX(finished_at) AS finished_at"). reject{ |job| job.finished_at.nil? } end def self.application_last_queued where("application_id IS NOT NULL").