Sha256: 172ffdf8da93e7142a9a79465aabed3d4ac20c5ee059a1817418e634e4b19e2b

Contents?: true

Size: 905 Bytes

Versions: 17

Compression:

Stored size: 905 Bytes

Contents

class SyncProjectTicketsJob

  def initialize(project)
    @project = project
  end

  attr_reader :project

  def run!
    Rails.logger.debug "\e[33;1mStart sync job\e[0m"

    start_time = Time.now
    @project.update_column :ticket_tracker_sync_started_at, start_time

    if @project.ticket_tracker.supports?(:syncing_milestones)
      milestones = project.all_milestones
      project.milestones.without(milestones).update_all(destroyed_at: Time.now)
    end

    if @project.ticket_tracker.supports?(:syncing_tickets)
      tickets = project.all_tickets
      project.tickets.without(tickets).update_all(destroyed_at: Time.now)
    end

    @project.update_column :last_ticket_tracker_sync_at, Time.now
  ensure
    @project.update_column :ticket_tracker_sync_started_at, nil

    Rails.logger.debug "\e[33;1mFinish sync job in \e[4m%.2f\e[0;33;1m seconds\e[0m" % (Time.now - start_time)
  end

end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
houston-core-0.8.0.pre app/jobs/sync_project_tickets_job.rb
houston-core-0.7.0 app/jobs/sync_project_tickets_job.rb
houston-core-0.7.0.beta4 app/jobs/sync_project_tickets_job.rb
houston-core-0.7.0.beta3 app/jobs/sync_project_tickets_job.rb
houston-core-0.7.0.beta2 app/jobs/sync_project_tickets_job.rb
houston-core-0.7.0.beta app/jobs/sync_project_tickets_job.rb
houston-core-0.6.3 app/jobs/sync_project_tickets_job.rb
houston-core-0.6.2 app/jobs/sync_project_tickets_job.rb
houston-core-0.6.1 app/jobs/sync_project_tickets_job.rb
houston-core-0.6.0 app/jobs/sync_project_tickets_job.rb
houston-core-0.5.6 app/jobs/sync_project_tickets_job.rb
houston-core-0.5.5 app/jobs/sync_project_tickets_job.rb
houston-core-0.5.4 app/jobs/sync_project_tickets_job.rb
houston-core-0.5.3 app/jobs/sync_project_tickets_job.rb
houston-core-0.5.2 app/jobs/sync_project_tickets_job.rb
houston-core-0.5.1 app/jobs/sync_project_tickets_job.rb
houston-core-0.5.0 app/jobs/sync_project_tickets_job.rb