Correctly order participants
This commit is contained in:
15
db/migrate/20250618122655_add_time_seconds_to_contestant.rb
Normal file
15
db/migrate/20250618122655_add_time_seconds_to_contestant.rb
Normal 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
3
db/schema.rb
generated
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user