Skip to content

Instantly share code, notes, and snippets.

wca-on-rails(prod)> Rake::Task['registration_version:migrate_v2_v3'].invoke("OklahomaQuietChampionship2024")
Migrating Registrations for Competition OklahomaQuietChampionship2024...Creating registration for user: 6412
Microservice reports (5) event_ids: ["333bf", "333fm", "333mbf", "444bf", "555bf"]
Monolith found (5) matching competition events: [122595, 122591, 122594, 122592, 122593]
Registration built: #<Registration id: nil, competition_id: "OklahomaQuietChampionship2024", comments: "", ip: "", user_id: 6412, created_at: nil, updated_at: nil, guests: 0, accepted_at: nil, accepted_by: nil, deleted_at: nil, deleted_by: nil, roles: nil, is_competing: true, administrative_notes: "", competing_status: "accepted">
Creating registration for user: 15289
Microservice reports (2) event_ids: ["333bf", "333fm"]
Monolith found (2) matching competition events: [122595, 122591]
Registration built: #<Registration id: nil, competition_id: "OklahomaQuietChampionship2024", comments: "", ip: "", user_id: 15289, created_at:
Migrating Registrations for Competition AachenOpen2025...I, [2024-11-13T09:07:31.922653 #2471] INFO -- request: GET http://wca_registration_handler:3000/api/internal/v1/AachenOpen2025/registrations
I, [2024-11-13T09:07:31.922869 #2471] INFO -- request: X-WCA-Service-Token: nil
User-Agent: "Faraday v2.12.0"
I, [2024-11-13T09:07:31.957518 #2471] INFO -- response: Status 200
I, [2024-11-13T09:07:31.957731 #2471] INFO -- response: x-frame-options: "SAMEORIGIN"
x-xss-protection: "0"
x-content-type-options: "nosniff"
x-permitted-cross-domain-policies: "none"
referrer-policy: "strict-origin-when-cross-origin"
content-type: "application/json; charset=utf-8"
root@6d22f37970d8:/app# bin/rake registration_version:migrate_v2_v3[AachenOpen2025]
Running via Spring preloader in process 2041
Migrating Registrations for Competition AachenOpen2025...I, [2024-11-13T08:51:43.929166 #2041] INFO -- request: GET http://wca_registration_handler:3000/api/internal/v1/AachenOpen2025/registrations
I, [2024-11-13T08:51:43.929424 #2041] INFO -- request: X-WCA-Service-Token: nil
User-Agent: "Faraday v2.12.0"
I, [2024-11-13T08:51:43.978630 #2041] INFO -- response: Status 200
I, [2024-11-13T08:51:43.978728 #2041] INFO -- response: x-frame-options: "SAMEORIGIN"
x-xss-protection: "0"
x-content-type-options: "nosniff"
x-permitted-cross-domain-policies: "none"
@dunkOnIT
dunkOnIT / gist:2b3cac834992b5f4505b17c1b9155049
Created September 19, 2023 06:00
WcaOnRails test profiling
Top 10 slowest examples (139.77 seconds, 9.0% of total time):
I18n does not have unused keys
20.94 seconds ./spec/i18n_spec.rb:14
AnonymizePerson generates padded wca id for a year with 99 ANON ids already
19.63 seconds ./spec/models/anonymize_person_spec.rb:25
DatabaseDumper dumps the database according to sanitizers
17.94 seconds ./spec/lib/database_dumper_spec.rb:44
Competition management when signed in as admin change competition id with validation error
12.34 seconds ./spec/features/competition_management_spec.rb:86
create competition tabs creating a new tab
@dunkOnIT
dunkOnIT / RAILS_CHEATSHEET.md
Created March 19, 2023 08:29 — forked from mdang/RAILS_CHEATSHEET.md
Ruby on Rails Cheatsheet

Ruby on Rails Cheatsheet

Architecture

Create a new application

Install the Rails gem if you haven't done so before

Running via Spring preloader in process 76
== 20150501004846 RenameDrupalIndicesToBeUnique: migrating ====================
-- rename_index(:cache, "expire", "cache_expire")
rake aborted!
StandardError: An error has occurred, all later migrations canceled:
Mysql2::Error: Table 'wca_development.cache' doesn't exist
/usr/local/bundle/gems/mysql2-0.5.4/lib/mysql2/client.rb:148:in `_query'
/usr/local/bundle/gems/mysql2-0.5.4/lib/mysql2/client.rb:148:in `block in query'
/usr/local/bundle/gems/mysql2-0.5.4/lib/mysql2/client.rb:147:in `handle_interrupt'
@dunkOnIT
dunkOnIT / initialise_logger.py
Created February 21, 2022 05:55
"initialise_logger" function - not sure how to test this
def initialise_logger(test_logs=False):
"""
Function to initialise the logger.
Parameters:
* log_type: Boolean representing whether or not the logs are for testing purposes. Defaults to False (ie, assume we are in prod)
NOTE: This is a bit of a bastardisation of test/prod, done so that I can run a waitress server while also running functions
from #general_testing - however, both of these are on my local machine (ie, not a true test/prod distinction)
"""