forked from edavis10/redmine_kanban
/
overview_kanban.rb
32 lines (27 loc) · 920 Bytes
/
overview_kanban.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
class OverviewKanban < Kanban
def initialize(attributes={})
super
@for = [:assigned_to]
@fill_incoming = false
@fill_backlog = false
end
def get_users
u = super
u.reject {|user| user.is_a?(UnknownUser) }
end
# After filtering issues, extract the highest priority one
def filter_issues(issues, filters = {})
filtered_issues = super(issues, filters)
return filtered_issues unless filtered_issues.present?
[extract_highest_priority_issue(filtered_issues)] # expects an Array returned
end
# After filtering issues, extract the highest priority one
def backlog_issues_for(options={})
issues = super
[extract_highest_priority_issue(issues)] # expects an Array returned
end
# Returns the first issue sorted by highest priority
def extract_highest_priority_issue(issues)
issues.sort {|a,b| a.priority.position <=> b.priority.position}.first
end
end