Thursday, September 19, 2019

  • Supercontest.
    • Datetime, picks, leaderboard:
      • Updated all the datetimes in the database to pacific. Updated the database timezone to pacific.
      • Updated the url defaults. Season is current or max. Week is current or 17.
      • Added g.current_season next to the existing g.season (which is the requested season) and g.is_current_season. Same for weeks.
      • Switched everything to be perfectly clear: all datetimes in the database are utc, all westgate lines are written after conversion from pacific time, and all sqlalchemy reads convert to local.
      • Debug toolbar is helping a lot. Noticed that on RESULTS_DAYS, it was bloated by about 500ms due to excessive queries.score_exists/get_score calls. Consolidated all of them. You could even go further by conditioning commit_scores not just on RESULTS_DAYS, but on time as well to tighten the range in which the extra calls are made. Call fetch_scores protected by results_days, then only call commit if any of the statuses aren't P/F/FO.
        • Reduced total db queries for the endpoint by >30 and profile reduced by ~400ms.
      • Completed redefined the pick view and how it's sorted, including the core/results backend to calculate as such. Now returns number of picks, current total points, current possible points, etc. Looks very good now.
      • LB and graph only show completed games in the total now. I added a col for in-progress games so you call still check "what if it all ended right now" status.
      • Percentages are now based on the picks that you have submitted, not the total (5 per week).
      • Combined a lot of the route logic, keeping the endpoints as thin as possible. Most of them outsource to functions in the core.results module now.
      • Added tooltips all over leaderboard for submitted picks, help, more.
      • Universal color for a lot of things.
      • Renamed the matchups tab to your picks. Renamed the picks tab to all picks.
      • Graph and leaderboard are now bulletproof for completed games.
      • Added req compilation back as a requirement of the test step, and ensured that compreqs were installed into the testenv.
    • My make test-python recipe is heavy-handed; it will compile all reqs and recreate the testenv. On subsequent runs, just use tox.
    • Got the bandit tests running again. Pytest is still obsolete.
    • App behaved well over TNF.
    • Closed https://github.com/brianmahlstedt/supercontest/issues/84.
    • Closed https://github.com/brianmahlstedt/supercontest/issues/94.
    • Dashboard.
      • Added a conditional (on my account) navtab for the flask monitor.
  • Bools have to be filtered |tojson to pass through jinja from flask to js. They'll be properly typeof() = boolean in js.
  • Forcing NBA owners to change their titles to governors due to historical implications is the same false equivalence as telling a German that they can't use ovens. It's offensive. It's irrelevant. Race is being used as glue to compare situations which have absolutely no relation.  It's not just a "doesn't affect you" situation - it's discriminatory, and should not be ok to concede. Finding these parallels with your lens of virtuous sensitivity is not progressive; it's an overshot of true equality, which slows resolution (if it doesn't destabilize entirely).
  • Nested dicts are fine to pass through jinja's |tojson filter for use in js.
  • Fed mouse. First time she's ever been snappy when I opened the terrarium. Used a broomstick to move her to the feeding tank.
  • My digital ocean droplet is in Santa Clara.
  • Supercontest.
  • Followup appointment with PCP. Got the referrals approved for both ortho and for PT.
    • The x-ray results:
      • Soft tissues: Unremarkable.
      • Bones: No acute fracture or subluxation. No lytic or blastic lesion.
      • Joints: The joint spaces are preserved. Articular surfaces are unremarkable.
    • So x-ray is fine. I'll probably need to do an MRI, since this would imply that the muscle is the source of injury.
    • Called the ortho place, made an appointment in Van Nuys for next wednesday.
    • I'm going to hold off on scheduling the PT until after the ortho evaluation is done. Stim, stretching, strengthening, etc - I can do that all on my own. The referral won't expired for 3 months, so I can schedule PT after ortho if need be.
  • Got adjusted at chiro (bought the 3/$90), then went to the new Chick-Fil-A.
  • For the last time: snake_case and camelCase and PascalCase.
  • Reminder for ISO8601: https://www.cl.cam.ac.uk/~mgk25/iso-time.html. All dates should be in the format YYYY-MM-DD.
  • A pipe | in a makefile is for order-only prerequisites. If you change any of those files, the parent recipe does not deem them necessary to rerun.
  • Postgres.
    • To get datatypes:
      • select column_name, data_type from information_schema.columns where table_name = '<mytable>';
      • select pg_typeof(<mycol>) from <mytable> limit 1;
    • I was very pleasantly surprised with postgresql's ability to internally parse timestamps. It correctly converted the type 'text' to 'timestamp with time zone' for every single datetime string from westgate. I thought I would have to use the python logic I had written to do this, but it was dead easy using sql in the migration instead.
    • lag() is a window function that allows you to update a row based on a previous row.
  • You can use direct sqlalchemy inside of an alembic migration if you want. This might be easier to (add, modify, etc) your data in python rather than doing it in sql. https://stackoverflow.com/questions/13676744/using-the-sqlalchemy-orm-inside-an-alembic-migration-how-do-i/
  • KFC is rolling out a chicken sandwich that uses glazed donuts instead of buns: https://www.cnn.com/2019/09/17/us/kfc-donut-chicken-sandwich-trnd/index.html.
  • Remember https://www.pngtosvg.com/ is the right place for free online vector conversion with color.
  • Just print(locals()) to show all args/kwargs passed to a function.
  • Changed my default text editor for git to vim: git config --global core.editor "vim"