[Issue #16] - Abstracted benchmarks from tests via BenchmarkProfile model, to allow for linking benchmarks with different runtime settings
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Gregory Ballantine
2025-09-11 16:09:00 -04:00
parent a736113abd
commit b19c95187b
8 changed files with 128 additions and 15 deletions

View File

@@ -2,6 +2,7 @@
require_relative 'base_controller'
require_relative '../models/test'
require_relative '../models/benchmark_profile'
# / (top-level) routes
class IndexController < BaseController

View File

@@ -3,7 +3,6 @@
# Benchmark - database model for PC benchmarks
class Benchmark < Sequel::Model
many_to_many :tests
one_to_many :results
one_to_many :benchmark_profiles
end

View File

@@ -0,0 +1,14 @@
# frozen_string_literal: true
# BenchmarkProfile - database model for benchmark settings profile
class BenchmarkProfile < Sequel::Model
many_to_one :benchmark
many_to_many :tests
one_to_many :results
def display_name
"#{benchmark.name} @ #{label}"
end
end

View File

@@ -4,7 +4,7 @@
class Result < Sequel::Model
many_to_one :test
many_to_one :benchmark
many_to_one :benchmark_profile
def formatted_score
return @avg_score

View File

@@ -5,10 +5,10 @@ class Test < Sequel::Model
one_to_many :result
many_to_one :hardware
many_to_many :benchmarks
many_to_many :benchmark_profiles
def benchmark?(benchmark_id)
return benchmarks_dataset.where(Sequel[:benchmarks][:id] => benchmark_id).any?
return benchmark_profiles_dataset.where(Sequel[:benchmark][:id] => benchmark_id).any?
end
end