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 ...@@ -16,8 +16,6 @@ class Groups::MilestonesController < ApplicationController
def show def show
project_milestones = Milestone.where(project_id: group.projects) project_milestones = Milestone.where(project_id: group.projects)
@group_milestone = Milestones::GroupService.new(project_milestones).milestone(title) @group_milestone = Milestones::GroupService.new(project_milestones).milestone(title)
@issues = @group_milestone.issues
@merge_requests = @group_milestone.merge_requests
end end
def update def update
......
...@@ -66,14 +66,30 @@ class GroupMilestone ...@@ -66,14 +66,30 @@ class GroupMilestone
end end
def issues def issues
milestones.map{ |milestone| milestone.issues }.flatten.group_by(&:state) @group_issues ||= milestones.map{ |milestone| milestone.issues }.flatten.group_by(&:state)
end end
def merge_requests 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 end
def participants def participants
milestones.map{ |milestone| milestone.participants.uniq }.reject(&:empty?).flatten milestones.map{ |milestone| milestone.participants.uniq }.reject(&:empty?).flatten
end 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 end
...@@ -2,5 +2,5 @@ ...@@ -2,5 +2,5 @@
.panel-heading= title .panel-heading= title
%ul{ class: "well-list merge_requests-sortable-list" } %ul{ class: "well-list merge_requests-sortable-list" }
- if merge_requests - 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 = render 'merge_request', merge_request: merge_request
...@@ -54,16 +54,16 @@ ...@@ -54,16 +54,16 @@
.tab-pane.active#tab-issues .tab-pane.active#tab-issues
.row .row
.col-md-6 .col-md-6
= render 'issues', title: "Open", issues: @issues["opened"] = render 'issues', title: "Open", issues: @group_milestone.opened_issues
.col-md-6 .col-md-6
= render 'issues', title: "Closed", issues: @issues["closed"] = render 'issues', title: "Closed", issues: @group_milestone.closed_issues
.tab-pane#tab-merge-requests .tab-pane#tab-merge-requests
.row .row
.col-md-6 .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 .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 .tab-pane#tab-participants
%ul.bordered-list %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