[#4552] Add issue counts to the Deliverable details
This commit is contained in:
1 parent
632cff8f7f
commit
20f89adf39
3 files changed
+54
-17
No files matched your search
@@ -128,6 +128,14 @@ class Deliverable < ActiveRecord::Base
|
||||
block.call
|
||||
end
|
||||
|
||||
def issues_by_status
|
||||
issues.inject({}) {|grouped, issue|
|
||||
grouped[issue.status] ||= []
|
||||
grouped[issue.status] << issue
|
||||
grouped
|
||||
}
|
||||
end
|
||||
|
||||
def retainer?
|
||||
type == "RetainerDeliverable"
|
||||
end
|
||||
|
||||
@@ -114,24 +114,18 @@
|
||||
<th colspan="2"><%= l(:label_issue_status_plural) %></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<%# TODO: Release 2 Issue status counters
|
||||
<tbody>
|
||||
<% deliverable.issues_by_status.each do |status, issues| %>
|
||||
<tr>
|
||||
<td>Proposed</td>
|
||||
<td class="number">1</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>On Hold</td>
|
||||
<td class="number">1</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Complete</td>
|
||||
<td class="number">14</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>All</strong></td>
|
||||
<td class="number">16</td>
|
||||
</tr>
|
||||
%>
|
||||
<td><%= h(status.name) %></td>
|
||||
<td class="number"><%= h(issues.length) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<tr>
|
||||
<td><strong><%= l(:label_all).capitalize %></strong></td>
|
||||
<td class="number"><%= deliverable.issues.count %></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
|
||||
@@ -391,6 +391,41 @@ class ContractsShowTest < ActionController::IntegrationTest
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
should "show the count of the issues by status for the deliverable" do
|
||||
configure_overhead_plugin
|
||||
|
||||
@manager = User.generate!
|
||||
|
||||
@deliverable1 = FixedDeliverable.generate!(:contract => @contract, :manager => @manager)
|
||||
@status1 = IssueStatus.generate!
|
||||
@status2 = IssueStatus.generate!
|
||||
|
||||
@issue1 = Issue.generate_for_project!(@project, :status => @status1)
|
||||
@issue2 = Issue.generate_for_project!(@project, :status => @status1)
|
||||
@issue3 = Issue.generate_for_project!(@project, :status => @status1)
|
||||
@issue4 = Issue.generate_for_project!(@project, :status => @status2)
|
||||
|
||||
@deliverable1.issues = [@issue1, @issue2, @issue3, @issue4]
|
||||
|
||||
assert_equal 4, @deliverable1.issues.count
|
||||
|
||||
visit_contract_page(@contract)
|
||||
assert_select "table#deliverables" do
|
||||
assert_select "tr" do
|
||||
assert_select "td", :text => /#{@status1}/
|
||||
assert_select "td.number", :text => /3/
|
||||
end
|
||||
assert_select "tr" do
|
||||
assert_select "td", :text => /#{@status2}/
|
||||
assert_select "td.number", :text => /1/
|
||||
end
|
||||
assert_select "tr" do
|
||||
assert_select "td strong", "All"
|
||||
assert_select "td.number", :text => /4/
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
should "show the current period for a Retainer" do
|
||||
|
||||
Reference in new issue
Block a user