gitlab-org--gitlab-foss/app/models/ci/scheduled_trigger.rb

22 lines
459 B
Ruby
Raw Normal View History

module Ci
class ScheduledTrigger < ActiveRecord::Base
extend Ci::Model
acts_as_paranoid
belongs_to :project
belongs_to :owner, class_name: "User"
def schedule_next_run!
next_time = Ci::CronParser.new(cron, cron_time_zone).next_time_from_now
2017-03-23 11:18:13 -04:00
if next_time.present?
update_attributes(next_run_at: next_time)
end
end
def update_last_run!
2017-03-23 11:18:13 -04:00
update_attributes(last_run_at: Time.now)
end
end
end