# frozen_string_literal: true

# Hardware - database model for PC hardware
class Hardware < Sequel::Model(:hardware)

  one_to_many :tests

  def bench_results
    br = {}

    results.each do |r|
      br[r.benchmark.name.to_s] = [] unless br.key?(r.benchmark.name)

      br[r.benchmark.name.to_s].push(r.avg_score)
    end

    return br
  end

end
