Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
bc5ae4962f | |||
ec2bf45a6e | |||
57163b10e4 |
@ -1,6 +1,9 @@
|
|||||||
$ ->
|
$ ->
|
||||||
chartInstance = null
|
chartInstance = null
|
||||||
|
|
||||||
|
$('#report-benchmarks').on 'change', (e) ->
|
||||||
|
$('#report-tests option').prop('selected', false)
|
||||||
|
|
||||||
$('#reports-download').on 'click', (e) ->
|
$('#reports-download').on 'click', (e) ->
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
canvas = $('#benchmark-chart')[0]
|
canvas = $('#benchmark-chart')[0]
|
||||||
|
@ -7,4 +7,8 @@ class Test < Sequel::Model
|
|||||||
many_to_one :hardware
|
many_to_one :hardware
|
||||||
many_to_many :benchmarks
|
many_to_many :benchmarks
|
||||||
|
|
||||||
|
def has_benchmark(benchmark_id)
|
||||||
|
return benchmarks_dataset.where(Sequel[:benchmarks][:id] => benchmark_id).any?
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -65,9 +65,25 @@ class GameData < Sinatra::Base
|
|||||||
|
|
||||||
tst.update(
|
tst.update(
|
||||||
name: params[:test_name],
|
name: params[:test_name],
|
||||||
type: params[:test_type]
|
hardware_id: params[:test_hardware],
|
||||||
|
description: params[:test_description]
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# create an array of the selected benchmarks
|
||||||
|
selected_benchmarks = Array(params[:test_benchmarks])
|
||||||
|
# remove benchmarks no longer associated with the test
|
||||||
|
tst.benchmarks.each do |b|
|
||||||
|
if not selected_benchmarks.include?(b)
|
||||||
|
tst.remove_benchmark(b)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
# associate the benchmarks to the test
|
||||||
|
selected_benchmarks.each do |b|
|
||||||
|
if not tst.has_benchmark(b)
|
||||||
|
tst.add_benchmark(b)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
redirect "/test/#{tst.id}"
|
redirect "/test/#{tst.id}"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<label for="benchmark_description">Benchmark description</label>
|
<label for="benchmark_description">Benchmark description</label>
|
||||||
<textarea id="benchmark_description" class="form-control" name="benchmark_description">Enter a description/notes here.</textarea>
|
<textarea id="benchmark_description" class="form-control" name="benchmark_description" placeholder="Enter a description/notes here."></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<label for="benchmark_description">Benchmark description</label>
|
<label for="benchmark_description">Benchmark description</label>
|
||||||
<textarea id="benchmark_description" class="form-control" name="benchmark_description"><%= benchmark.description %></textarea>
|
<textarea id="benchmark_description" class="form-control" name="benchmark_description" placeholder="Enter a description/notes here."><%= benchmark.description %></textarea>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
<label for="test_benchmarks">Benchmarks</label>
|
<label for="test_benchmarks">Benchmarks</label>
|
||||||
<select id="test_benchmarks" class="form-select" name="test_benchmarks[]" multiple>
|
<select id="test_benchmarks" class="form-select" name="test_benchmarks[]" multiple>
|
||||||
<% for b in benchmarks %>
|
<% for b in benchmarks %>
|
||||||
<option value="<%= b.id %>"><%= b.name %></option>
|
<option value="<%= b.id %>" <% if test.has_benchmark(b.id) %>selected<% end %>><%= b.name %></option>
|
||||||
<% end %>
|
<% end %>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<input class="btn btn-primary w-100" type="submit" value="Create Test">
|
<input class="btn btn-primary w-100" type="submit" value="Submit Changes">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
Reference in New Issue
Block a user