summaryrefslogtreecommitdiff
path: root/app/models/dashboard_group_milestone.rb
blob: 9bcc95e35a5705f1819c63fe080002095b9d06eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true
# Dashboard Group Milestones are milestones that allow us to pull more info out for the UI that the Milestone object doesn't allow for
class DashboardGroupMilestone < GlobalMilestone
  extend ::Gitlab::Utils::Override

  attr_reader :group_name

  def initialize(milestone)
    super

    @group_name = milestone.group.full_name
  end

  def self.build_collection(groups)
    Milestone.of_groups(groups.select(:id))
             .reorder_by_due_date_asc
             .order_by_name_asc
             .active
             .map { |m| new(m) }
  end
end