BigW Consortium Gitlab

Commit 86fc145c by Felipe Artur

Order issues by priority

parent ff7fe2d1
module Milestoneish
def closed_items_count(user)
memoize_per_user(user, :closed_items_count) do
(count_issues_by_state(user)['closed'] || 0) + merge_requests.closed_and_merged.size
(count_issues_by_state(user)['closed'].count || 0) + merge_requests.closed_and_merged.size
end
end
......@@ -12,7 +12,7 @@ module Milestoneish
end
def total_issues_count(user)
count_issues_by_state(user).values.sum
issues_visible_to_user(user).length
end
def complete?(user)
......@@ -39,8 +39,8 @@ module Milestoneish
def issues_visible_to_user(user)
memoize_per_user(user, :issues_visible_to_user) do
IssuesFinder.new(user, issues_finder_params)
.execute.includes(:assignees).where(milestone_id: milestoneish_ids)
IssuesFinder.new(user, issues_finder_params.merge({ sort: 'priority'}))
.execute.preload(:assignees).where(milestone_id: milestoneish_ids)
end
end
......@@ -66,7 +66,9 @@ module Milestoneish
def count_issues_by_state(user)
memoize_per_user(user, :count_issues_by_state) do
issues_visible_to_user(user).reorder(nil).group(:state).count
# Need to group and count using ruby array to not break
# label ordering
issues_visible_to_user(user).to_a.group_by(&:state)
end
end
......
......@@ -44,7 +44,7 @@ class Issue < ActiveRecord::Base
scope :created_after, -> (datetime) { where("created_at >= ?", datetime) }
scope :include_associations, -> { includes(:labels, project: :namespace) }
scope :preload_associations, -> { preload(:labels, project: :namespace) }
after_save :expire_etag_cache
......
......@@ -8,11 +8,11 @@
= title
- if show_counter
.counter
= number_with_delimiter(issuables.size)
= number_with_delimiter(issuables.length)
- class_prefix = dom_class(issuables).pluralize
%ul{ class: "well-list milestone-#{class_prefix}-list", id: "#{class_prefix}-list-#{id}" }
= render partial: 'shared/milestones/issuable',
collection: issuables.recent,
collection: issuables,
as: :issuable,
locals: { show_project_name: show_project_name, show_full_project_name: show_full_project_name }
......@@ -68,10 +68,10 @@
.sidebar-collapsed-icon
%strong
= icon('hashtag', 'aria-hidden': 'true')
%span= milestone.issues_visible_to_user(current_user).count
%span= milestone.issues_visible_to_user(current_user).length
.title.hide-collapsed
Issues
%span.badge= milestone.issues_visible_to_user(current_user).count
%span.badge= milestone.issues_visible_to_user(current_user).length
- if project && can?(current_user, :create_issue, project)
= link_to new_namespace_project_issue_path(project.namespace, project, issue: { milestone_id: milestone.id }), class: "pull-right", title: "New Issue" do
New issue
......@@ -79,11 +79,11 @@
%span.milestone-stat
= link_to milestones_browse_issuables_path(milestone, type: :issues) do
Open:
= milestone.issues_visible_to_user(current_user).opened.count
= milestone.issues_visible_to_user(current_user).opened.length
%span.milestone-stat
= link_to milestones_browse_issuables_path(milestone, type: :issues, state: 'closed') do
Closed:
= milestone.issues_visible_to_user(current_user).closed.count
= milestone.issues_visible_to_user(current_user).closed.length
.block.merge-requests
.sidebar-collapsed-icon
......
......@@ -31,7 +31,7 @@
.tab-content.milestone-content
- if milestone.is_a?(GlobalMilestone) || can?(current_user, :read_issue, @project)
.tab-pane.active#tab-issues{ data: { sort_endpoint: (sort_issues_namespace_project_milestone_path(@project.namespace, @project, @milestone) if @project && current_user) } }
= render 'shared/milestones/issues_tab', issues: milestone.issues_visible_to_user(current_user).include_associations, show_project_name: show_project_name, show_full_project_name: show_full_project_name
= render 'shared/milestones/issues_tab', issues: milestone.issues_visible_to_user(current_user).preload_associations, show_project_name: show_project_name, show_full_project_name: show_full_project_name
.tab-pane#tab-merge-requests{ data: { sort_endpoint: (sort_merge_requests_namespace_project_milestone_path(@project.namespace, @project, @milestone) if @project && current_user) } }
-# loaded async
= render "shared/milestones/tab_loading"
......
---
title: Remove Drag and drop and sorting from milestone view
title: Remove issues/merge requests drag n drop and sorting from milestone view
merge_request:
author:
......@@ -117,7 +117,7 @@ module API
finder_params = {
project_id: user_project.id,
milestone_title: milestone.title,
sort: 'created_desc'
sort: 'label_priority'
}
issues = IssuesFinder.new(current_user, finder_params).execute
......@@ -140,7 +140,7 @@ module API
finder_params = {
project_id: user_project.id,
milestone_title: milestone.title,
sort: 'created_desc'
sort: 'label_priority'
}
merge_requests = MergeRequestsFinder.new(current_user, finder_params).execute
......
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