<% if new_lines.to_i>0 %>
<% if new_coverage %>
<p>
- <span class="big"><a href="<%= url_for_drilldown('new_coverage', :period => dashboard_configuration.period_index, :only_periods => true) -%>"><%= new_coverage.format_numeric_value(variation_value(new_coverage))||'-' -%></a></span> coverage
+ <span class="big"><a href="<%= url_for_drilldown('new_coverage', :period => dashboard_configuration.period_index) -%>"><%= new_coverage.format_numeric_value(variation_value(new_coverage))||'-' -%></a></span> coverage
</p>
<% end %>
<p>
- <%= new_lines.to_i -%> new lines to cover
+ <a href="<%= url_for_drilldown('new_lines_to_cover', :period => dashboard_configuration.period_index) -%>"><%= new_lines.to_i -%></a> new lines to cover
</p>
<% if new_line_coverage %>
<p>
- <a href="<%= url_for_drilldown('new_uncovered_lines', :highlight => 'new_line_coverage', :period => dashboard_configuration.period_index, :only_periods => true) -%>"><%= new_line_coverage.format_numeric_value(variation_value(new_line_coverage))||'-' -%></a> line coverage
+ <a href="<%= url_for_drilldown('new_uncovered_lines', :highlight => 'new_line_coverage', :period => dashboard_configuration.period_index) -%>"><%= new_line_coverage.format_numeric_value(variation_value(new_line_coverage))||'-' -%></a> line coverage
</p>
<% end %>
<% if new_branch_coverage %>
<p>
- <a href="<%= url_for_drilldown('new_uncovered_conditions', :highlight => 'new_branch_coverage', :period => dashboard_configuration.period_index, :only_periods => true) -%>"><%= new_branch_coverage.format_numeric_value(variation_value(new_branch_coverage))||'-' -%></a> branch coverage
+ <a href="<%= url_for_drilldown('new_uncovered_conditions', :highlight => 'new_branch_coverage', :period => dashboard_configuration.period_index) -%>"><%= new_branch_coverage.format_numeric_value(variation_value(new_branch_coverage))||'-' -%></a> branch coverage
</p>
<%
end
public static final String NEW_LINES_TO_COVER_KEY = "new_lines_to_cover";
public static final Metric NEW_LINES_TO_COVER = new Metric.Builder(NEW_LINES_TO_COVER_KEY, "New lines to cover", Metric.ValueType.INT)
.setDescription("New lines to cover")
- .setDirection(Metric.DIRECTION_BETTER)
+ .setDirection(Metric.DIRECTION_WORST)
+ .setQualitative(false)
.setDomain(DOMAIN_TESTS)
.setFormula(new SumChildValuesFormula(false))
.setHidden(true)
@DefaultTab(metrics = {CoreMetrics.COVERAGE_KEY, CoreMetrics.LINES_TO_COVER_KEY, CoreMetrics.UNCOVERED_LINES_KEY, CoreMetrics.LINE_COVERAGE_KEY,
CoreMetrics.CONDITIONS_TO_COVER_KEY, CoreMetrics.UNCOVERED_CONDITIONS_KEY, CoreMetrics.BRANCH_COVERAGE_KEY,
CoreMetrics.NEW_COVERAGE_KEY, CoreMetrics.NEW_UNCOVERED_LINES_KEY, CoreMetrics.NEW_LINE_COVERAGE_KEY,
- CoreMetrics.NEW_LINES_TO_COVER_KEY, CoreMetrics.NEW_BRANCH_COVERAGE_KEY, CoreMetrics.NEW_CONDITIONS_TO_COVER_KEY
+ CoreMetrics.NEW_LINES_TO_COVER_KEY, CoreMetrics.NEW_BRANCH_COVERAGE_KEY, CoreMetrics.NEW_CONDITIONS_TO_COVER_KEY, CoreMetrics.NEW_UNCOVERED_CONDITIONS_KEY
})
@UserRole(UserRole.CODEVIEWER)
private static final class CoverageTab implements RubyRailsPage {
SECTION=Navigation::SECTION_RESOURCE
def measures
- @metric = select_metric(params[:metric], Metric::NCLOC)
+ @metric = select_metric(params[:metric], 'ncloc')
@highlighted_metric = Metric.by_key(params[:highlight]) || @metric
# selected resources
@project = project_key ? Project.by_key(project_key) : nil
if @project.nil?
render :text => "Project [#{project_key}] not found", :status => 404
- return
end
end
# * <tt>:resource</tt> - id or key of the selected resource
# * <tt>:highlight</tt> - key of the metric to highlight, different than the metric to drilldown.
# * <tt>:period</tt> - period index
- # * <tt>:only_periods</tt> - true if only v
#
# === Examples
#
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
#
class Drilldown
- attr_reader :snapshot, :columns
+ attr_reader :snapshot, :columns, :metric
def initialize(resource, metric, selected_resource_ids, options={})
@snapshot=Snapshot.find(:first, :conditions => {:islast => true, :project_id => resource.id}, :include => [:project])
+ @metric=metric
@columns=[]
column=nil
def highlighted_resource
@highlighted_resource
end
+
+ def display_value?
+ ProjectMeasure.exists?(["snapshot_id=? and metric_id=? and value is not null", @snapshot.id, @metric.id])
+ end
+
+ def display_period?(period_index)
+ ProjectMeasure.exists?(["snapshot_id=? and metric_id=? and variation_value_#{period_index.to_i} is not null", @snapshot.id, @metric.id])
+ end
end
class DrilldownColumn
<%= render :partial => 'header' -%>
+
+
+<% if params[:period] && @snapshot.project_snapshot.periods? %>
+<div id="snapshot_title" class="page_title">
+ <h4>
+ <form method="GET" action="<%= url_for :action => 'measures' -%>" style="display: inline">
+ <input type="hidden" name="metric" value="<%= params[:metric] -%>" />
+
+ <select id="select-comparison" name="period" onchange="submit()" class="small">
+ <% if @drilldown.display_value? %>
+ <option value="">Time changes...</option>
+ <% end %>
+ <% for period_index in 1..5 do %>
+ <%= period_select_options(@snapshot, 1) if @drilldown.display_period?(period_index) -%>
+ <% end %>
+ </select>
+ </form>
+ </h4>
+</div>
+<% end %>
+
+
+
+
<div class="dashbox">
<% if @characteristic %>
<h3><%= @highlighted_metric.short_name -%> / <%= h(@characteristic.name(true)) -%></h3>