@expandable=(@lines!=nil)
@filtered=!@expanded
- conditions='switched_off is not true AND snapshot_id=?'
+ conditions='snapshot_id=?'
values=[@snapshot.id]
unless params[:rule].blank?
severity=Sonar::RulePriority.id(params[:rule])
conditions+=' AND id=-1'
end
end
+
+ if params[:switchedOff]
+ @switchedOff=true
+ conditions+='AND switched_off=?'
+ values<<true
+ else
+ conditions+='AND (switched_off IS NULL OR switched_off=?)'
+ values<<false
+ end
RuleFailure.find(:all, :include => ['rule', 'reviews' ], :conditions => [conditions] + values, :order => 'failure_level DESC').each do |violation|
# sorted by severity => from blocker to info
def add_all_users ( user_options )
User.find( :all ).each do |user|
userName = user.name
- if current_user.id == user.id
+ if current_user && current_user.id == user.id
userName = "Me (" + user.name + ")"
end
user_options << [userName, user.id.to_s]
end %>
<% if @display_violations %>
+ <td class="<%= 'first' if first -%>">
+ <input type="checkbox" value="true" name="switchedOff" id="switchedOff" <%= 'checked' if @switchedOff -%> onclick="applyOptions()"/>
+ <label for="expand">Show only switched-off violations</label>
+ </td>
<td class="<%= 'first' if first -%>">
<select id="period" name="period" onchange="applyOptions()">
<option value="">Time changes...</option>