metric = Metric.by_id(params[:metric])
if metric && (metric.name=='active_reviews' || metric.name=='unassigned_reviews' || metric.name=='unplanned_reviews' || metric.name=='false_positive_reviews'|| metric.name=='unreviewed_violations' || metric.name=='new_unreviewed_violations')
rule_param = metric.name.gsub(/new_/, '')
+
+ # hack to select the correct option in the rule filter select-box
+ params[:rule] = rule_param
end
end
end
end
+
if @period
date=@snapshot.period_datetime(@period)
if date
if options.has_key? :review_statuses
statuses = options[:review_statuses]
- if !statuses.empty?
+ unless statuses.empty?
if statuses.include? nil
if statuses.size==1
# only nil : unreviewed violations
- conditions << 'not exists(select id from reviews where rule_failure_permanent_id=rule_failures.id)'
+ conditions << 'not exists(select id from reviews where rule_failure_permanent_id=rule_failures.permanent_id)'
else
- conditions << '(reviews.status in (?) or not exists(select id from reviews where rule_failure_permanent_id=rule_failures.id))'
+ conditions << '(reviews.status in (?) or not exists(select id from reviews where rule_failure_permanent_id=rule_failures.permanent_id))'
values << options[:review_statuses].compact
end
else
conditions << 'reviews.assignee_id=?'
values << review_assignee_id.to_i
else
- conditions << '(reviews.assignee_id is null or not exists(select id from reviews where rule_failure_permanent_id=rule_failures.id))'
+ conditions << '(reviews.assignee_id is null or not exists(select id from reviews where rule_failure_permanent_id=rule_failures.permanent_id))'
end
end