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,4 +1,8 @@
# frozen_string_literal: true
# /benchmark routes
class GameData < Sinatra::Base
get '/benchmark' do
benchmarks = Benchmark.reverse(:updated_at).limit(10).all()
@ -20,6 +24,7 @@ class GameData < Sinatra::Base
description: params[:benchmark_description]
)
redirect "/benchmark"
redirect "/benchmark/#{benchmark.id}"
end
end

View File

@ -1,4 +1,8 @@
# frozen_string_literal: true
# /hardware routes
class GameData < Sinatra::Base
get '/hardware' do
hardware = Hardware.reverse(:updated_at).limit(10).all()
@ -19,6 +23,7 @@ class GameData < Sinatra::Base
type: params[:hardware_type]
)
redirect "/hardware"
redirect "/hardware#{hardware.id}"
end
end

View File

@ -1,4 +1,8 @@
# frozen_string_literal: true
# / (top-level) routes
class GameData < Sinatra::Base
get '/' do
tests = Test.reverse(:updated_at).limit(10).all()
results = Result.reverse(:updated_at).limit(10).all()
@ -10,5 +14,4 @@ class GameData < Sinatra::Base
}
end
# more routes...
end

View File

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

View File

@ -1,4 +1,8 @@
# frozen_string_literal: true
# /result routes
class GameData < Sinatra::Base
get '/result' do
results = Result.reverse(:updated_at).limit(10).all()
@ -19,12 +23,10 @@ class GameData < Sinatra::Base
}
end
post '/result/add' do
benchmark = Benchmark.where(:id => params[:result_benchmark]).first()
result_minimum = params[:result_minimum] if params.key?(:result_minimum)
result_maximum = params[:result_maximum] if params.key?(:result_maximum)
result_minimum = params[:result_minimum] if params.has_key?(:result_minimum)
result_maximum = params[:result_maximum] if params.has_key?(:result_maximum)
result = Result.create(
Result.create(
hardware_id: params[:result_hardware],
benchmark_id: params[:result_benchmark],
score: params[:result_average],
@ -32,6 +34,7 @@ class GameData < Sinatra::Base
maximum_score: result_maximum
)
redirect "/result"
redirect '/result'
end
end

View File

@ -1,4 +1,8 @@
# frozen_string_literal: true
# /test routes
class GameData < Sinatra::Base
get '/test' do
tests = Test.reverse(:updated_at).limit(10).all()
@ -30,19 +34,16 @@ class GameData < Sinatra::Base
date_tag = params[:test_date_tag]
# make sure the date tag field is formatting properly
unless date_tag.start_with?('(')
date_tag = '(' + date_tag
end
unless date_tag.end_with?(')')
date_tag = date_tag + ')'
end
date_tag = "(#{date_tag}" unless date_tag.start_with?('(')
date_tag += ')' unless date_tag.end_with?(')')
test = Test.create(
date_tag: params[:test_date_tag],
date_tag: date_tag,
hardware_id: params[:test_hardware],
benchmark_id: params[:test_benchmark]
)
redirect "/test/#{test.id}"
end
end