why retrieve milestone again in GlobalMilestone.rb
https://gitlab.com/gitlab-org/gitlab-ce/blob/master/app/models/global_milestone.rb#L20
milestones = child_milestones.select(:id, :title).group_by(&:title).map do |title, grouped|
milestones_relation = Milestone.where(id: grouped.map(&:id))
new(title, milestones_relation)
end
since child_milestones have already been retrieved from the database, why don't we just use them directly instead of Milestone.where to retrieve them again?
milestones = child_milestones.group_by(&:title).map do |title, grouped|
milestones_relation = grouped
new(title, milestones_relation)
end
Another place needs to be changed is
def milestoneish_ids
milestones.select(:id)
end
to def milestoneish_ids milestones.map(&:id) end