-
- Full hedgineer podcast episode released today: https://www.youtube.com/watch?v=3VIGPUsKbAE
- First snow of the season last night!
- Lots of private work.
- MotorGrrl confirmed I can pick the ducati up before the end of the day tomorrow to avoid the March invoice.
- QBR = quarterly business review.
- SBSC. Continued on the new statuses/teams tables, and many corresponding changes that I folded into this ticket.
- https://gitlab.com/bmahlstedt/supercontest/-/issues/175
- Wrote a new
supercontest.models.schemas
module. I want the frontend views to match the DB tables as much as possible, keeping app logic thin (and this will only get MORE true with the generated-cols change for results), so the passage of sqlalchemy rows to the frontend becomes more and more direct.
- Since sqla rows are not json-serializable, we have a few options: parse to json-serializable objects (what I was doing before), use python’s builtin
dataclasses
module, or an industry-standard third-party. I’ve chosen the latter, marshmallow
, since it (as a serialization lib) has plugins to both flask and sqlalchemy.
- Read through the
flask-marshmallow
and marshmallow-sqlalchemy
docs.
- Included the FKs and relationships in the schemas, and made the relationships nested with the child objects, rather than just PK (marshmallow’s default).
- Note that I had to make the schemas uni-directional for this (all model relationships are bidirectional). This is obviously because it would result in an infinite-length string when serializing. The python ORM doesn’t have to worry about that, all bidirectional relations point to the same underlying/respective object.
- Did a TON of js cleanup.
- All view-specific modules are now pure (functions only), bundled in full by assets but called only in the views they’re needed.
- Merged some of the common behavior (like flashes) into
common.js
.
- All the html is correspondingly better; variables are serialized as necessary before being passed by flask, then rendered by jinja into js vars. ONLY the vars necessary are passed, not the overkill of the previous
flask_vars_to_js.html
implementation.
- There was a ton of ridiculous
id="<var1>-<var2>-<var3>"
behavior in the templates so that js has access to things like userId that jinja populates in the loops. All gone. The js does proper lookups now.
- All of this will clean even further with the React splitout.
- Made it so that
-
appears on the regular leaderboard for weeks that were unpicked (rather than 0
). A red 0
appears if they submitted 5 picks and hit 0. A regular 0
appears if they did not submitted 1-4 picks and hit 0.