- Remember to pass python lists through jinja with the |tojson filter for use in javascript. Same with bools. For dicts, dump them python side then pass with |safe.
- Supercontest.
- Added row count (rank, I guess, since it’s sorted?) to the all-picks view. Makes it easy to compare to 45 (of the lb, which shows all users with season picks instead of week picks).
- Added header with total pick counts for each team, and colored status of every game. This is the only place that has this info now; previously it would just highlight your picks on the matchups tabs, and then everyone’s picks on this tab (which might have excluded teams; an often occurence).
- App behaved well all day with the sunday rush, even with all the new changes (which were substantial). The live updated of points/possiblepoints for completed games was awesome. It ranked everybody dynamically, and was interesting to watch throughout the day.
- Rewrote the `joins` module to properly use joins instead of subqueries. This is a lot cleaner. It removes all the `.c.` nonsense, and I don’t have to be explicit (manually) about all the columns to forward through the joins. The only slightly annoying thing is that it returns the query results as a tuple divided by source table, so you have to unpack it to get the data you want. With the subquery structure, it was all flat so I could access the data directly with the column name.
- Made the leaderboard sort with the same 3 keys as the all-picks view: total points, percentage, user id.
- Added percentage at the top of the lb for each week, showing the performance of the entire league (theoretically should be close to 50).
- Finished the graphql update. Fully got filters working. Didn’t do joins. Uploaded a new client pkg to pypi with examples. Added twine instructions to ADMIN.md.
- augmented-ui is a css kit you can include via cdn or npm pkg that transforms your site into cyberpunk: https://medium.com/better-programming/augmented-ui-cyberpunk-inspired-web-ui-made-easy-d463c0371144.
- Foam roll on the legs = crucial for training.
- Awesome website that does the same thing Ken’s script used to do: https://www.fantasy-football-power-rankings.com/espn/1187979/2019. Power rankings, where it lists your record if you were to play every other team every week. Just like total points for, it is a more absolute metric of success without the random luck of head-head matchup order. Yahoo already reports this in your weekly recap, but ESPN doesn’t, so this site provides it. https://github.com/JakePartusch/fantasy-football-power-rankings.
- If joining the same table twice for multiple conditions, use sqlalchemy.orm.aliased. Same as a simple table table2 rename in sql.
- Gonna feed gbro 1/2c twice a day instead of leaving big bowls out to self feed. This is slightly more than the recommended amount, but he’s definitely overweight. I want to see how much he’s consuming, then briley can adjust as he wants.
- If you create a list in python with [x] * n, then they all point to the same object. If you update one of them, every element will mirror the same update.
- Made another batch of tahini, but instead of using 100% sesame seeds, I used a ratio of about 80% sesame to 20% pecans, yielding pecan tahini. Incredible.
- Made another batch of protein bars: oats, dates, protein powder, pecan tahini, banana, cinnamon, cacao powder. Incredible.
- Read through most of the graphql documentation again.
- Remember, it converts resolver names and such from snake_case to camelCase. I disably this during schema instantiation with auto_camelcase=False.
- Within an ObjectType class, each resolve_x method corresponding to the field x that you define in the constructor.
- They intentionally do not allow select *. Graphql is meant to be deliberate: fetch only what you need, not all cols. https://github.com/graphql/graphql-spec/issues/127.
- SQLAlchemyConnectionField is the magic liason. Should map most of your entire model, all cols, field types, sortability, etc.
- There is an extension to this that allows filtering: https://pypi.org/project/graphene-sqlalchemy-filter/. graphene-sqlalchemy can’t do it right out of the box (simply). You’d have to add custom resolvers that pass args through query.filter() etc.
- It’s worth mentioning: the documentation surrounding this effort is horrendous. I have a very simple use case: take a few sqlalchemy models with foreign keys, allow flask graphql queries with filters on cols, for both direct queries as well as queries on joined tables. This common implementation should be trivial to implement, and it’s not even close to that.
- Filters: eq, ne, like, ilike, regexp, is_null, in, not_in, lt, lte, gt, gte, range.
- Example: {seasons(filters:{season_start_lt:”2019-06-01″}){edges{node{id season}}}}. This would return just the rows from 2018 (lt = less than), and only the id and year number.
- Datetimes are of the form “2019-11-01T00:00:00”
- sqlalchemy has an `add_columns` which you can call after a join to create a more sql-standard select return table. https://docs.sqlalchemy.org/en/13/orm/query.html#sqlalchemy.orm.query.Query.add_columns. This can be used to get around the necessity of unpacking the multiple table results if you query a join. You can even add labels.