Sha256: 5d9b066bf393ea873ca8ff23e35a483538625ed26e98c39f91f9bf60323b7de7

Contents?: true

Size: 888 Bytes

Versions: 27

Compression:

Stored size: 888 Bytes

Contents

module ForemanOpenscap::ReportDashboard
  class Data
    attr_reader :report

    def initialize(filter = "")
      @filter = filter
      @report = {}
      fetch_data
    end

    private
    attr_writer :report
    attr_accessor :filter

    def fetch_data
      report.update(
        {
          :passed  => passed_breakdowns,
          :failed  => failed_breakdowns,
          :othered => othered_breakdowns
        }
      )
    end

    def passed_breakdowns
      Log.where(:result => 'pass').joins("INNER JOIN reports ON reports.id = report_id").count(:id).to_f
    end

    def failed_breakdowns
      Log.where(:result => 'fail').joins("INNER JOIN reports ON reports.id = report_id").count(:id).to_f
    end

    def othered_breakdowns
      Log.where(:result => Log::SCAP_RESULT[2..-1]).joins("INNER JOIN reports ON reports.id = report_id").count(:id).to_f
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
foreman_openscap-0.7.13 app/services/foreman_openscap/report_dashboard/data.rb
foreman_openscap-0.7.12 app/services/foreman_openscap/report_dashboard/data.rb
foreman_openscap-0.7.11 app/services/foreman_openscap/report_dashboard/data.rb
foreman_openscap-0.7.10 app/services/foreman_openscap/report_dashboard/data.rb
foreman_openscap-0.8.3 app/services/foreman_openscap/report_dashboard/data.rb
foreman_openscap-0.7.9 app/services/foreman_openscap/report_dashboard/data.rb
foreman_openscap-0.7.8 app/services/foreman_openscap/report_dashboard/data.rb
foreman_openscap-0.7.7 app/services/foreman_openscap/report_dashboard/data.rb
foreman_openscap-0.8.2 app/services/foreman_openscap/report_dashboard/data.rb
foreman_openscap-0.7.6 app/services/foreman_openscap/report_dashboard/data.rb
foreman_openscap-0.8.1 app/services/foreman_openscap/report_dashboard/data.rb
foreman_openscap-0.7.5 app/services/foreman_openscap/report_dashboard/data.rb
foreman_openscap-0.8.0 app/services/foreman_openscap/report_dashboard/data.rb
foreman_openscap-0.7.4 app/services/foreman_openscap/report_dashboard/data.rb
foreman_openscap-0.7.3 app/services/foreman_openscap/report_dashboard/data.rb
foreman_openscap-0.7.2 app/services/foreman_openscap/report_dashboard/data.rb
foreman_openscap-0.7.1 app/services/foreman_openscap/report_dashboard/data.rb
foreman_openscap-0.6.7 app/services/foreman_openscap/report_dashboard/data.rb
foreman_openscap-0.7.0 app/services/foreman_openscap/report_dashboard/data.rb
foreman_openscap-0.6.6 app/services/foreman_openscap/report_dashboard/data.rb