end
end
- def format_difference(new, prefix, measure_name1, measure_name2)
- format(new, prefix, measure_name1).to_i - format(new, prefix, measure_name2).to_i
+ def format_ratio(new, prefix, measure_name1, measure_name2)
+ '(' + (format(new, prefix, measure_name1).to_i - format(new, prefix, measure_name2).to_i).to_s + '/' + format(new, prefix, measure_name1) + ')'
end
end
\ No newline at end of file
<% new = @period && (measure('new_coverage') || measure('new_it_coverage') || measure('new_overall_coverage')) %>
<% if new -%>
- <p><%= message('coverage_viewer.on_new_code') -%> :</p>
+ <p><%= message('coverage_viewer.on_new_code') -%>:</p>
<% end -%>
<table class="coverage">
<% [('overall_' if @display_overall_coverage), '', ('it_' if @display_it_coverage)].compact.each_with_index do |prefix, index| -%>
<tr>
<% if index == 0 -%>
- <td class="right big" style="width: 80px;"><%= format(new, prefix, 'coverage') -%></td>
+ <td class="right big" style="width: 60px;"><%= format(new, prefix, 'coverage') -%></td>
<td></td>
- <td class="sep"></td>
<td class="name"><%= h Metric.name_for('line_coverage') -%>:</td>
<td class="value">
<%= format(new, prefix, 'line_coverage') -%>
- (<%= format_difference(new, prefix, 'lines_to_cover', 'uncovered_lines') -%>
- / <%= format(new, prefix, 'lines_to_cover') -%>)
+ <%= format_ratio(new, prefix, 'lines_to_cover', 'uncovered_lines') -%>
</td>
<td class="sep"></td>
<td class="name"><%= h Metric.name_for('branch_coverage') -%>:</td>
<td class="value">
<%= format(new, prefix, 'branch_coverage') -%>
- (<%= format_difference(new, prefix, 'conditions_to_cover', 'uncovered_conditions') -%>
- / <%= format(new, prefix, 'conditions_to_cover') -%>)
+ <%= format_ratio(new, prefix, 'conditions_to_cover', 'uncovered_conditions') -%>
</td>
<% else -%>
- <td class="right"><%= format(new, prefix, 'coverage') -%></td>
+ <td class="right value"><%= format(new, prefix, 'coverage') -%></td>
<td><%= message(prefix + 'coverage_viewer.by') -%></td>
- <td class="sep"></td>
<td colspan="2"></td>
<td class="sep"></td>
<td colspan="2"></td>
</table>
<%= render :partial => 'options' -%>
-</div>
-
+</div>
\ No newline at end of file