Sha256: 5f1f7a21e9db5713ac458f4edbf8a8b4db70cb173a2c43368c00cc4da7d9fc0b

Contents?: true

Size: 474 Bytes

Versions: 57

Compression:

Stored size: 474 Bytes

Contents

class Stats
  include ActiveModel::Model

  attr_accessor :passed, :passed_with_warnings, :failed, :pending

  def submitted
    passed + passed_with_warnings + failed
  end

  def done?
    failed + pending == 0
  end

  def started?
    submitted > 0
  end

  def self.from_statuses(statuses)
    Stats.new(statuses.inject({passed: 0, passed_with_warnings: 0, failed: 0, pending: 0}) do |accum, status|
      accum[status.group.to_sym] += 1
      accum
    end)
  end
end

Version data entries

57 entries across 57 versions & 2 rubygems

Version Path
mumuki-domain-7.4.0 app/models/stats.rb
mumuki-domain-7.3.2 app/models/stats.rb
mumuki-domain-7.3.1 app/models/stats.rb
mumuki-domain-7.2.3 app/models/stats.rb
mumuki-domain-7.3.0 app/models/stats.rb
mumuki-domain-7.2.2 app/models/stats.rb
mumuki-domain-7.2.1 app/models/stats.rb
mumuki-domain-7.2.0 app/models/stats.rb
mumuki-laboratory-7.1.0 vendor/bundle/ruby/2.3.0/bundler/gems/mumuki-domain-925adf85cca8/app/models/stats.rb
mumuki-domain-7.1.0 app/models/stats.rb
mumuki-laboratory-7.0.12 vendor/bundle/ruby/2.3.0/bundler/gems/mumuki-domain-74da3d4af98c/app/models/stats.rb
mumuki-domain-7.0.6 app/models/stats.rb
mumuki-domain-7.0.5 app/models/stats.rb
mumuki-domain-7.0.4 app/models/stats.rb
mumuki-domain-7.0.3 app/models/stats.rb
mumuki-laboratory-7.0.11 vendor/bundle/ruby/2.3.0/bundler/gems/mumuki-domain-f892f79c60f0/app/models/stats.rb
mumuki-domain-7.0.2 app/models/stats.rb
mumuki-domain-7.0.1 app/models/stats.rb
mumuki-domain-7.0.0 app/models/stats.rb
mumuki-domain-6.7.2 app/models/stats.rb