Commit d3796b84 authored by Marin Jankovski's avatar Marin Jankovski

Show all issues and merge requests that could be considered opened or closed,...

Show all issues and merge requests that could be considered opened or closed, includes reopened and merged.
parent d145f09c
......@@ -16,8 +16,6 @@ class Groups::MilestonesController < ApplicationController
def show
project_milestones = Milestone.where(project_id: group.projects)
@group_milestone = Milestones::GroupService.new(project_milestones).milestone(title)
@issues = @group_milestone.issues
@merge_requests = @group_milestone.merge_requests
end
def update
......
......@@ -66,14 +66,30 @@ class GroupMilestone
end
def issues
milestones.map{ |milestone| milestone.issues }.flatten.group_by(&:state)
@group_issues ||= milestones.map{ |milestone| milestone.issues }.flatten.group_by(&:state)
end
def merge_requests
milestones.map{ |milestone| milestone.merge_requests }.flatten.group_by(&:state)
@group_merge_requests ||= milestones.map{ |milestone| milestone.merge_requests }.flatten.group_by(&:state)
end
def participants
milestones.map{ |milestone| milestone.participants.uniq }.reject(&:empty?).flatten
end
def opened_issues
issues.values_at("opened", "reopened").compact.flatten
end
def closed_issues
issues['closed']
end
def opened_merge_requests
merge_requests.values_at("opened", "reopened").compact.flatten
end
def closed_merge_requests
merge_requests.values_at("closed", "merged", "locked").compact.flatten
end
end
......@@ -2,5 +2,5 @@
.panel-heading= title
%ul{ class: "well-list merge_requests-sortable-list" }
- if merge_requests
- merge_requests.sort_by(&:position).each do |merge_request|
- merge_requests.each do |merge_request|
= render 'merge_request', merge_request: merge_request
......@@ -54,16 +54,16 @@
.tab-pane.active#tab-issues
.row
.col-md-6
= render 'issues', title: "Open", issues: @issues["opened"]
= render 'issues', title: "Open", issues: @group_milestone.opened_issues
.col-md-6
= render 'issues', title: "Closed", issues: @issues["closed"]
= render 'issues', title: "Closed", issues: @group_milestone.closed_issues
.tab-pane#tab-merge-requests
.row
.col-md-6
= render 'merge_requests', title: "Open", merge_requests: @merge_requests["opened"]
= render 'merge_requests', title: "Open", merge_requests: @group_milestone.opened_merge_requests
.col-md-6
= render 'merge_requests', title: "Closed", merge_requests: @merge_requests["closed"]
= render 'merge_requests', title: "Closed", merge_requests: @group_milestone.closed_merge_requests
.tab-pane#tab-participants
%ul.bordered-list
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment