Fixed a lot of linter warnings
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
2023-12-11 13:08:46 -05:00
parent 34741691ed
commit 516f125ea7
14 changed files with 76 additions and 34 deletions

View File

@ -1,3 +1,6 @@
# frozen_string_literal: true
# Benchmark - database model for PC benchmarks
class Benchmark < Sequel::Model
one_to_many :tests

View File

@ -1,3 +1,6 @@
# frozen_string_literal: true
# Hardware - database model for PC hardware
class Hardware < Sequel::Model(:hardware)
one_to_many :tests

View File

@ -1,3 +1,5 @@
# frozen_string_literal: true
require_relative 'hardware'
require_relative 'benchmark'
require_relative 'result'

View File

@ -1,9 +1,12 @@
# frozen_string_literal: true
# Result - database model for benchmark results
class Result < Sequel::Model
many_to_one :test
def formatted_score()
return self.score
def formatted_score
return @score
end
end

View File

@ -1,27 +1,30 @@
# frozen_string_literal: true
# Test - database model for PC hardware tests
class Test < Sequel::Model
one_to_many :results # link Test model to its related results
many_to_one :benchmark # link Test model back to its benchmark
many_to_one :hardware # link Test model back to hardware used in test
one_to_many :results # link Test model to its related results
many_to_one :benchmark # link Test model back to its benchmark
many_to_one :hardware # link Test model back to hardware used in test
# formats the name of the test for display in the web UI
def formatted_name()
return "#{self.date_tag} - #{self.hardware.name} / #{self.benchmark.name}"
def formatted_name
return "#{@date_tag} - #{@hardware.name} / #{@benchmark.name}"
end
# formats the name of the test for use in a graph
def graph_name()
return "#{self.hardware.name} (#{self.date_tag})"
def graph_name
return "#{@hardware.name} (#{@date_tag})"
end
# determines whether the test has enough results to fulfill the requirement
def valid?()
return (self.results.length >= $conf.get('testing.minimum_results_required'))
def valid?
return (@results.length >= $conf.get('testing.minimum_results_required'))
end
# determines how many results are still missing for a test
def missing_results()
return ($conf.get('testing.minimum_results_required') - self.results.length)
def missing_results
return ($conf.get('testing.minimum_results_required') - @results.length)
end
end