Correctly order participants
All checks were successful
CI / scan_ruby (push) Successful in 19s
CI / scan_js (push) Successful in 12s
CI / lint (push) Successful in 12s
CI / test (push) Successful in 31s

This commit is contained in:
sto
2025-06-18 14:49:16 +02:00
parent a33f3ff4de
commit 194c126c90
6 changed files with 31 additions and 3 deletions

View File

@@ -0,0 +1,15 @@
class AddTimeSecondsToContestant < ActiveRecord::Migration[8.0]
def change
add_column :contestants, :time_seconds, :integer
Contestant.find_each do |contestant|
contestant.time_seconds = 0
contestant.completions.each do |completion|
contestant.time_seconds += completion.time_seconds
end
contestant.save
end
change_column_null :contestants, :time_seconds, true
end
end

3
db/schema.rb generated
View File

@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[8.0].define(version: 2025_05_17_131707) do
ActiveRecord::Schema[8.0].define(version: 2025_06_18_122655) do
create_table "active_storage_attachments", force: :cascade do |t|
t.string "name", null: false
t.string "record_type", null: false
@@ -60,6 +60,7 @@ ActiveRecord::Schema[8.0].define(version: 2025_05_17_131707) do
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "display_time"
t.integer "time_seconds"
t.index ["contest_id"], name: "index_contestants_on_contest_id"
end