Sha256: 9b544d5771bde646c9c1803a527d875a7e3badc00f18339133ec1825239a1684

Contents?: true

Size: 734 Bytes

Versions: 2

Compression:

Stored size: 734 Bytes

Contents

class ReplaceArfReportBreakdownView < ActiveRecord::Migration
   def self.up
     execute <<-SQL
CREATE OR REPLACE VIEW scaptimony_arf_report_breakdowns AS
  SELECT
    arf.id as arf_report_id,
    COUNT(CASE WHEN result.name IN ('pass','fixed') THEN 1 ELSE null END) as passed,
    COUNT(CASE result.name WHEN 'fail' THEN 1 ELSE null END) as failed,
    COUNT(CASE WHEN result.name NOT IN ('pass', 'fixed', 'fail', 'notselected', 'notapplicable') THEN 1 ELSE null END) as othered
  FROM
    scaptimony_arf_reports arf
  LEFT OUTER JOIN
    scaptimony_xccdf_rule_results rule
    ON arf.id = rule.arf_report_id
  LEFT OUTER JOIN scaptimony_xccdf_results result
    ON rule.xccdf_result_id = result.id
  GROUP BY arf.id;
SQL
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
scaptimony-0.3.0 db/migrate/20141121164042_replace_arf_report_breakdown_view.rb
scaptimony-0.2.0 db/migrate/20141121164042_replace_arf_report_breakdown_view.rb