BigW Consortium Gitlab

global_milestones.rb 569 Bytes
Newer Older
1 2 3 4
module GlobalMilestones
  extend ActiveSupport::Concern

  def milestones
5
    epoch = DateTime.parse('1970-01-01')
6 7
    @milestones = MilestonesFinder.new.execute(@projects, params)
    @milestones = GlobalMilestone.build_collection(@milestones)
8
    @milestones = @milestones.sort_by { |x| x.due_date.nil? ? epoch : x.due_date }
9 10 11 12 13 14 15 16 17 18 19 20
  end

  def milestone
    milestones = Milestone.of_projects(@projects).where(title: params[:title])

    if milestones.present?
      @milestone = GlobalMilestone.new(params[:title], milestones)
    else
      render_404
    end
  end
end