Added API routes to provide some information for JS; added CoffeeScript to grab benchmark results for a test

This commit is contained in:
2025-06-19 00:38:36 -04:00
parent d17b66920a
commit 8cd47d7e70
8 changed files with 96 additions and 16 deletions

23
src/routes/api1.rb Normal file
View File

@ -0,0 +1,23 @@
# frozen_string_literal: true
# /api/v1 routes
class GameData < Sinatra::Base
get '/api/v1/benchmark/details' do
benchmark_id = params[:benchmark_id]
benchmark = Benchmark.where(id: benchmark_id).first()
json benchmark.values()
end
get '/api/v1/results' do
test_id = params[:test_id]
benchmark_id = params[:benchmark_id]
results = Result.where(test_id: test_id, benchmark_id: benchmark_id).all()
json results.map(&:values)
end
end