Sha256: 74eeda319f3f2808185e5ad262cf7ad3ef4f95380daa992c888102f46c82c388

Contents?: true

Size: 705 Bytes

Versions: 2

Compression:

Stored size: 705 Bytes

Contents

class CreateScaptimonyArfReportBreakdowns < ActiveRecord::Migration
   def self.up
     execute <<-SQL
CREATE 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,
    scaptimony_xccdf_rule_results rule,
    scaptimony_xccdf_results result
  WHERE
    arf.id = rule.arf_report_id
    AND 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/20141121120326_create_scaptimony_arf_report_breakdowns.rb
scaptimony-0.2.0 db/migrate/20141121120326_create_scaptimony_arf_report_breakdowns.rb