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
|
end
|
||||||
post '/result/add' do
|
post '/result/add' do
|
||||||
benchmark = Benchmark.where(:id => params[:result_benchmark]).first()
|
benchmark = Benchmark.where(:id => params[:result_benchmark]).first()
|
||||||
formatted_score = params[:result_average]
|
|
||||||
if benchmark.scoring == 'fps'
|
if benchmark.scoring == 'fps'
|
||||||
formatted_score = params[:result_average] + ':' + params[:result_minimum] + ':' + params[:result_maximum]
|
formatted_score = params[:result_average] + ':' + params[:result_minimum] + ':' + params[:result_maximum]
|
||||||
end
|
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(
|
result = Result.create(
|
||||||
hardware_id: params[:result_hardware],
|
hardware_id: params[:result_hardware],
|
||||||
benchmark_id: params[:result_benchmark],
|
benchmark_id: params[:result_benchmark],
|
||||||
score: formatted_score
|
score: params[:result_average],
|
||||||
|
minimum_score: result_minimum,
|
||||||
|
maximum_score: result_maximum
|
||||||
)
|
)
|
||||||
|
|
||||||
redirect "/result"
|
redirect "/result"
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
<div class="cell medium-4">
|
<div class="cell medium-4">
|
||||||
<label>
|
<label>
|
||||||
Average score:
|
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>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user