Compare commits
2 Commits
2884b94b7f
...
d526fa30f4
| Author | SHA1 | Date | |
|---|---|---|---|
| d526fa30f4 | |||
| 3dbc11d294 |
@@ -1,16 +1,27 @@
|
||||
FROM ruby:3.4
|
||||
FROM ruby:3.4-slim
|
||||
|
||||
RUN gem install bundler
|
||||
# 1. Install essential build tools for gems like 'pg' or 'sqlite3'
|
||||
RUN apt-get update -qq && apt-get install -y \
|
||||
build-essential \
|
||||
libpq-dev \
|
||||
curl \
|
||||
git
|
||||
|
||||
WORKDIR /usr/src/game-data
|
||||
|
||||
COPY Gemfile Gemfile.l*ck ./
|
||||
# 2. Set environment variables for the Gem volume we discussed
|
||||
ENV BUNDLE_PATH=/usr/local/bundle \
|
||||
BUNDLE_BIN=/usr/local/bundle/bin \
|
||||
PATH=/usr/local/bundle/bin:$PATH
|
||||
|
||||
RUN bundle check || bundle install
|
||||
|
||||
RUN gem install rake
|
||||
# 3. Copy Gemfile first to leverage layer caching
|
||||
COPY Gemfile Gemfile.lock ./
|
||||
RUN bundle install
|
||||
|
||||
# 4. Copy the application code
|
||||
COPY . ./
|
||||
|
||||
ENTRYPOINT ["bash", "entrypoints/dev.sh"]
|
||||
# 5. Make sure your entrypoint script is executable
|
||||
RUN chmod +x entrypoints/dev.sh
|
||||
|
||||
ENTRYPOINT ["bash", "entrypoints/dev.sh"]
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ ! -f ./data/gamedata.db ]; then
|
||||
rake db:migrate
|
||||
fi
|
||||
# Run the migrations to make sure the DB is up-to-date
|
||||
echo 'Checking database status...'
|
||||
rake db:migrate
|
||||
|
||||
# Start the HTTP server
|
||||
echo 'Starting development server...'
|
||||
rake server:dev
|
||||
|
||||
@@ -12,7 +12,7 @@ class ResultController < BaseController
|
||||
|
||||
Result.create(
|
||||
test_id: params[:result_test],
|
||||
benchmark_id: params[:result_benchmark],
|
||||
benchmark_profile_id: params[:result_benchmark],
|
||||
avg_score: params[:result_average],
|
||||
min_score: result_minimum,
|
||||
max_score: result_maximum
|
||||
|
||||
@@ -42,7 +42,7 @@ class TestController < BaseController
|
||||
benchmarks = Array(params[:test_benchmarks])
|
||||
# associate the benchmarks to the test
|
||||
benchmarks.each do |b|
|
||||
tst.add_benchmark(b)
|
||||
tst.add_benchmark_profile(b)
|
||||
end
|
||||
|
||||
redirect "/test/#{tst.id}"
|
||||
@@ -81,13 +81,13 @@ class TestController < BaseController
|
||||
selected_benchmarks = Array(params[:test_benchmarks])
|
||||
|
||||
# remove benchmarks no longer associated with the test
|
||||
tst.benchmarks.dup.each do |b|
|
||||
tst.remove_benchmark(b.id) unless selected_benchmarks.include?(b.id)
|
||||
tst.benchmark_profiles.dup.each do |b|
|
||||
tst.remove_benchmark_profile(b.id) unless selected_benchmarks.include?(b.id)
|
||||
end
|
||||
|
||||
# associate the benchmarks to the test
|
||||
selected_benchmarks.each do |b|
|
||||
tst.add_benchmark(b) unless tst.benchmark?(b)
|
||||
tst.add_benchmark_profile(b) unless tst.benchmark?(b)
|
||||
end
|
||||
|
||||
redirect "/test/#{tst.id}"
|
||||
|
||||
@@ -8,7 +8,7 @@ class Test < Sequel::Model
|
||||
many_to_many :benchmark_profiles
|
||||
|
||||
def benchmark?(benchmark_id)
|
||||
return benchmark_profiles_dataset.where(Sequel[:benchmark][:id] => benchmark_id).any?
|
||||
return benchmark_profiles_dataset.where(Sequel[:benchmark_profiles][:id] => benchmark_id).any?
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -28,8 +28,10 @@
|
||||
<label for="test_benchmarks">Benchmarks</label>
|
||||
<select id="test_benchmarks" class="form-select" name="test_benchmarks[]" multiple>
|
||||
<% for b in benchmarks %>
|
||||
<option value="<%= b.id %>"><%= b.name %></option>
|
||||
<% for bp in b.benchmark_profiles %>
|
||||
<option value="<%= bp.id %>"><%= bp.display_name %></option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -28,8 +28,10 @@
|
||||
<label for="test_benchmarks">Benchmarks</label>
|
||||
<select id="test_benchmarks" class="form-select" name="test_benchmarks[]" multiple>
|
||||
<% for b in benchmarks %>
|
||||
<option value="<%= b.id %>" <% if test.benchmark?(b.id) %>selected<% end %>><%= b.name %></option>
|
||||
<% for bp in b.benchmark_profiles %>
|
||||
<option value="<%= bp.id %>" <% if test.benchmark?(bp.id) %>selected<% end %>><%= bp.display_name %></option>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
<% tests.each do |t| %>
|
||||
<tr>
|
||||
<td><a href="/test/<%= t.id %>"><%= t.name %></a></td>
|
||||
<td><%= t.benchmarks.length %></td>
|
||||
<td><%= t.benchmark_profiles.length %></td>
|
||||
<td><%= date_format(t.created_at) %></td>
|
||||
<td><%= date_format(t.updated_at) %></td>
|
||||
</tr>
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
<div class="col-12 col-md-5 mb-3 mb-md-0">
|
||||
<label for="result_benchmark">Add benchmark result:</label>
|
||||
<select class="form-select" id="result_benchmark" name="result_benchmark">
|
||||
<% test.benchmarks.each do |b| %>
|
||||
<option value="<%= b.id %>"><%= b.name %></option>
|
||||
<% test.benchmark_profiles.each do |b| %>
|
||||
<option value="<%= b.id %>"><%= b.display_name %></option>
|
||||
<% end %>
|
||||
</select>
|
||||
</div>
|
||||
@@ -71,8 +71,8 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% test.benchmarks.each do |benchmark| %>
|
||||
<tr data-benchmark-id="<%= benchmark.id %>"></tr>
|
||||
<% test.benchmark_profiles.each do |bp| %>
|
||||
<tr data-benchmark-id="<%= bp.id %>"></tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user