Skip to content

Instantly share code, notes, and snippets.

@xaviershay
Last active August 28, 2022 00:17
Show Gist options
  • Save xaviershay/0b91f69b9f4eeaa795f47b661bfd17e8 to your computer and use it in GitHub Desktop.
Save xaviershay/0b91f69b9f4eeaa795f47b661bfd17e8 to your computer and use it in GitHub Desktop.
Request for services - Geelong Cross Country Club Handicapping System

Request for services - Geelong Cross Country Club Handicapping System

Context

The Geelong Cross Country Club (an established non-profit running group) uses a rails application to manage race results and handicaps for members. It was written by me in 2014 and has seen sporadic maintenance and features since. The codebase is relatively standard rails running against postgres on heroku. GCCC have requested some changes that I am unable to get to in a timely manner, so they are looking to engage a (paid) contractor. The app is also due for a round of upgrades.

I am doing an initial screen of contractors, but will ultimately put you in touch to work with GCCC directly. I am available for an initial kick off, questions and code review.

Tasks

Priority - Tech Debt

  • Why is one of the acceptance tests failing?
  • Upgrade to latest gems where easy (current rails: 5)
  • Upgrade to latest stable ruby (current: 2.7)
  • Verify on latest stable heroku setup (current: unsure)

High priority - Client requested

  • Ability to add notes when adjusting handicap (so we know why they are coming up in review next time and what penalties they have)
  • Ability to use negative times for a runner (so people can start before 9am but whole field doesn't have to calculate what 8:45 + 0:19:20 is for example)
  • Bug: If adding an invite to a race where start times have changed, their go time is sometimes still calculated from the original scratch mark (e.g. remove Marie from race, everyone moves forward 11 mins, but invites are added as starting 11 mins later than they should be)

Lower priority - Client requested

  • Removing any championship points for runner running on a discretional handicap (currently have to make invitational then add an extra run)
  • Deleting runner (duplicates etc)
  • Adding runner to completed race
  • Use Riegel (^1.06) formula for converting to 5k ideal time
  • Adding a difficulty rating column to member pages (maybe based on % second or third runner is down from best?)
  • Automatically flag eligible members for review if they finish bottom 25% 5 races in a row?
  • All dates in DD-MM-YYYY format
  • Old races (e.g. 5 years + ago) show current age group (not age group from then)

Code base

> bundle exec rake stats
+----------------------+--------+--------+---------+---------+-----+-------+
| Name                 |  Lines |    LOC | Classes | Methods | M/C | LOC/M |
+----------------------+--------+--------+---------+---------+-----+-------+
| Controllers          |    780 |    641 |      15 |      66 |   4 |     7 |
| Helpers              |     69 |     55 |       0 |       9 |   0 |     4 |
| Models               |   2202 |   1596 |      26 |     244 |   9 |     4 |
| Mailers              |      0 |      0 |       0 |       0 |   0 |     0 |
| JavaScripts          |    410 |    324 |       0 |      43 |   0 |     5 |
| Libraries            |     49 |     41 |       0 |       0 |   0 |     0 |
+----------------------+--------+--------+---------+---------+-----+-------+
| Total                |   3510 |   2657 |      41 |     362 |   8 |     5 |
+----------------------+--------+--------+---------+---------+-----+-------+
> bin/test
+ export FIVEMAT_PROFILE=1
+ FIVEMAT_PROFILE=1
+ export PRELOAD_RAILS=1
+ PRELOAD_RAILS=1
+ bin/test-unit
Category .. (0.0s)
Distance ......... (0.0s)
Duration ...... (0.0s)
Form::NewCompetitor ... (0.0s)
Form::EditCompetitor ... (0.0s)
Form::CreateEvent .... (0.0s)
Form::EditEvent .. (0.0s)
Form::TimingRow .....*... (0.0s)
Form::Timing . (0.0s)
HandicapCalculator .* (0.0s)
Handicap ............. (0.0s)
Importers::Race ...... (0.0s)
LogService ............ (0.0s)
Presenter::HandicapRun ............................ (0.01s)
Presenter::Run .. (0.0s)
Presenter::ScratchRun ............................ (0.01s)
Results ... (0.04s)
SeriesService ....... (0.0s)
StartTimeCalculator .. (0.0s)
DivisionalTimingMapper ... (0.0s)

Finished in 0.11313 seconds (files took 1.4 seconds to load)
145 examples, 0 failures, 2 pending
Coverage report generated for spec:acceptance, spec:integration, spec:unit to /home/xavier/Code/gccc/coverage. 1406 / 1831 LOC (76.79%) covered.
+ bin/test-integration
 set_config 
------------
 
(1 row)

ApplicationHelper ... (0.0s)
Competitor ...................... (0.55s)
CompetitorsController . (0.03s)
EventsController .. (0.12s)
RaceNumbersController . (0.0s)
Event ....................... (0.72s)
HandicapService ........ (0.26s)
RaceNumber . (0.0s)
SealedSeries ..... (0.12s)
time helpers .......... (0.01s)
importing timings . (0.04s)

Finished in 2.01 seconds (files took 1.57 seconds to load)
77 examples, 0 failures
Coverage report generated for spec:acceptance, spec:integration, spec:unit to /home/xavier/Code/gccc/coverage. 1546 / 1831 LOC (84.43%) covered.
+ bin/test-acceptance
which phantomjs: /usr/bin/phantomjs
Adding competitors to an event .... (1.1s)
logging in as an admin user ... (0.19s)
Running an event F.. (6.83s)

  1) Running an event Handicap event
     Failure/Error: click_button "Save Draft", match: :first
     
     Capybara::ElementNotFound:
       Unable to find visible button "Save Draft"
     # /home/xavier/.gem/ruby/2.7.2/gems/capybara-2.16.1/lib/capybara/node/finders.rb:314:in `block in synced_resolve'
     # /home/xavier/.gem/ruby/2.7.2/gems/capybara-2.16.1/lib/capybara/node/base.rb:85:in `synchronize'
     # /home/xavier/.gem/ruby/2.7.2/gems/capybara-2.16.1/lib/capybara/node/finders.rb:302:in `synced_resolve'
     # /home/xavier/.gem/ruby/2.7.2/gems/capybara-2.16.1/lib/capybara/node/finders.rb:37:in `find'
     # /home/xavier/.gem/ruby/2.7.2/gems/capybara-2.16.1/lib/capybara/node/actions.rb:61:in `click_button'
     # /home/xavier/.gem/ruby/2.7.2/gems/capybara-2.16.1/lib/capybara/session.rb:810:in `block (2 levels) in <class:Session>'
     # /home/xavier/.gem/ruby/2.7.2/gems/capybara-2.16.1/lib/capybara/dsl.rb:50:in `block (2 levels) in <module:DSL>'
     # ./spec/acceptance/admin/create_event_spec.rb:112:in `block (2 levels) in <top (required)>'
Editing an event ... (0.33s)
competitor status *** (0.0s)
editing competitor details . (0.16s)
Reviewing handicaps .. (0.55s)
Running an event . (1.16s)
Member management .. (0.62s)
Race numbers . (0.15s)
Reports . (0.13s)
Running an event . (4.16s)
Managing admins . (1.0s)
championship leaderboards .. (0.32s)
health . (0.03s)

Finished in 16.86 seconds (files took 1.53 seconds to load)
29 examples, 1 failure, 3 pending

Failed examples:

rspec ./spec/acceptance/admin/create_event_spec.rb:4 # Running an event Handicap event
Coverage report generated for spec:acceptance, spec:integration, spec:unit to /home/xavier/Code/gccc/coverage. 1721 / 1831 LOC (93.99%) covered.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment