[Issue #16] - Finished updating Test controller routes that used to reference Benchmarks
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Gregory Ballantine
2025-10-09 15:43:53 -04:00
parent b19c95187b
commit 2884b94b7f
7 changed files with 24 additions and 17 deletions

View File

@@ -42,7 +42,7 @@ class TestController < BaseController
benchmarks = Array(params[:test_benchmarks])
# associate the benchmarks to the test
benchmarks.each do |b|
tst.add_benchmark(b)
tst.add_benchmark_profile(b)
end
redirect "/test/#{tst.id}"
@@ -81,13 +81,13 @@ class TestController < BaseController
selected_benchmarks = Array(params[:test_benchmarks])
# remove benchmarks no longer associated with the test
tst.benchmarks.dup.each do |b|
tst.remove_benchmark(b.id) unless selected_benchmarks.include?(b.id)
tst.benchmark_profiles.dup.each do |b|
tst.remove_benchmark_profile(b.id) unless selected_benchmarks.include?(b.id)
end
# associate the benchmarks to the test
selected_benchmarks.each do |b|
tst.add_benchmark(b) unless tst.benchmark?(b)
tst.add_benchmark_profile(b) unless tst.benchmark?(b)
end
redirect "/test/#{tst.id}"

View File

@@ -7,8 +7,8 @@ class Test < Sequel::Model
many_to_one :hardware
many_to_many :benchmark_profiles
def benchmark?(benchmark_id)
return benchmark_profiles_dataset.where(Sequel[:benchmark][:id] => benchmark_id).any?
def benchmark?(benchmark_profile_id)
return benchmark_profiles_dataset.where(Sequel[:benchmark_profiles][:id] => benchmark_profile_id).any?
end
end