Added functionality for better tracking of the minimum and maximum fps
This commit is contained in:
parent
7e38154bc1
commit
a1a00d9fe5
17
db/migrations/0002_add_result_type.rb
Normal file
17
db/migrations/0002_add_result_type.rb
Normal file
@ -0,0 +1,17 @@
|
||||
Sequel.migration do
|
||||
|
||||
up do
|
||||
alter_table(:results) do
|
||||
add_column :type, String, null: false, default: 'fps'
|
||||
add_column :minimum_score, String
|
||||
add_column :maximum_score, String
|
||||
end
|
||||
end
|
||||
|
||||
down do
|
||||
drop_column :results, :type
|
||||
drop_column :results, :minimum_score
|
||||
drop_column :results, :maximum_score
|
||||
end
|
||||
|
||||
end
|
@ -20,15 +20,19 @@ class GameData < Sinatra::Base
|
||||
end
|
||||
post '/result/add' do
|
||||
benchmark = Benchmark.where(:id => params[:result_benchmark]).first()
|
||||
formatted_score = params[:result_average]
|
||||
if benchmark.scoring == 'fps'
|
||||
formatted_score = params[:result_average] + ':' + params[:result_minimum] + ':' + params[:result_maximum]
|
||||
end
|
||||
|
||||
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(
|
||||
hardware_id: params[:result_hardware],
|
||||
benchmark_id: params[:result_benchmark],
|
||||
score: formatted_score
|
||||
score: params[:result_average],
|
||||
minimum_score: result_minimum,
|
||||
maximum_score: result_maximum
|
||||
)
|
||||
|
||||
redirect "/result"
|
||||
|
@ -35,7 +35,7 @@
|
||||
<div class="cell medium-4">
|
||||
<label>
|
||||
Average score:
|
||||
<input type="number" name="result_average" value="0.0" step="0.01">
|
||||
<input type="number" name="result_average" value="0.0" step="0.01" required>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user