2 limit = widget_properties["numberOfLines"]
7 metric = Metric.find(:first, :conditions => "name = 'weighted_violations'")
9 snapshots_conditions = ["snapshots.scope = 'FIL'"]
11 snapshots_conditions << "(snapshots.qualifier = 'CLA' OR snapshots.qualifier = 'FIL' OR snapshots.qualifier = 'TRK')"
12 snapshots_conditions << "project_measures.rule_id IS NULL"
13 snapshots_conditions << "project_measures.characteristic_id IS NULL"
14 snapshots_conditions << "snapshots.path LIKE :path"
15 snapshots_values[:path] = "#{@snapshot.path}#{@snapshot.id}.%"
16 snapshots_conditions << "project_measures.metric_id = :m_id"
17 snapshots_values[:m_id] = metric.id
18 snapshots_conditions << "snapshots.root_project_id = :root_id"
19 snapshots_values[:root_id] = @snapshot.root_project_id
21 snapshots=Snapshot.find(:all,
22 :conditions => [snapshots_conditions.join(' AND '), snapshots_values],
23 :include => ['project', 'measures'],
24 :order => "project_measures.value DESC",
28 <div class="line-block">
29 <div style="float:right">
30 <a href="<%= url_for_drilldown(metric) -%>"><%= message('widget.hotspot_metric.more') -%></a>
32 <h3><%= message('widget.hotspot_most_violated_resources.name') -%></h3>
35 <table id="most-violated-resources-<%= widget.id -%>" class="data">
36 <thead><tr><th colspan="11"/></tr></thead>
41 violations_per_severity={}
42 s.measure(metric).text_value.split(';').each do |part|
43 fields=part.split('=')
44 violations_per_severity[fields[0]]=fields[1]
47 <tr class="<%= cycle 'even','odd', :name => ('hotspot_most_violated_resources' + widget.id.to_s) -%>">
49 <%= link_to_resource(resource, resource.name) -%>
51 <td class="small right">
52 <%= image_tag('priority/BLOCKER.png') -%>
54 <td class="small left">
55 <%= violations_per_severity["BLOCKER"] ? violations_per_severity["BLOCKER"].to_s : "0" -%>
57 <td class="small right">
58 <%= image_tag('priority/CRITICAL.png') -%>
60 <td class="small left">
61 <%= violations_per_severity["CRITICAL"] ? violations_per_severity["CRITICAL"].to_s : "0" -%>
63 <td class="small right">
64 <%= image_tag('priority/MAJOR.png') -%>
66 <td class="small left">
67 <%= violations_per_severity["MAJOR"] ? violations_per_severity["MAJOR"].to_s : "0" -%>
69 <td class="small right">
70 <%= image_tag('priority/MINOR.png') -%>
72 <td class="small left">
73 <%= violations_per_severity["MINOR"] ? violations_per_severity["MINOR"].to_s : "0" -%>
75 <td class="small right">
76 <%= image_tag('priority/INFO.png') -%>
78 <td class="small left">
79 <%= violations_per_severity["INFO"] ? violations_per_severity["INFO"].to_s : "0" -%>