• Friday

    • Very common to write custom sort functions as lambdas (even if many levels of sort), but remember you can go even further if your custom logic has function wrappers or other inputs you need to consider (sorted‘s key param just passes the element of the iterable you’re sorting, one argument). Or if you need to type annotate in a clear way, a custom function is better. Remember: you just need to return a tuple of the numbers that matter, in order. Negate the ones you want to sort in the opposite direction, for that level.
    • Equinox massage. Better quality than massage envy. I got the master therapist session, although not sure the diff between master and normal (assume training/licensing).
    • Lots of private work.
    • typing.cast for list comprehensions and other places where normal : <> annotations do not work.
    • Rise Gardens came out with a membership plan now.
      • Analysis of current costs for 1 triple garden:
        • My current subscription for nutrients is $78 every 4 mo (all-in, including tax+shipping). 200mL pH, 500mL blossom, 500mL sprout, 1000mL thrive. So that’s $234/yr.
        • Then I’d buy seeds as necessary. Say 8x 4-packs, at $12 apiece, every 3mo. Plus (assume) 10% for tax+shipping. So that’s $422/yr.
        • Total $656/yr to stock a single triple rise garden. Then you’d double for 2 triple gardens, to $1312/yr.
      • Perks of membership plan:
        • Membership is $360/yr (I got it for $300/yr with LOYALGARDNER bc first signup).
        • Free shipping on orders >$30.
        • 15% off sitewide.
        • Reedeemable loyalty points.
        • Plus a bunch of others: VIP sales, early access, welcome gifts (microgreens+nursery for me), events, birthday gifts, merch, more.
        • You can add to upcoming boxes at will (or change seeds, etc), just like butcherbox.
        • You get 6x 4-packs every 3 mo. Then you’d add 2x more (to equal the above), at $10 apiece (15% off), every 3mo. Free shipping. Ignore tax (say that’s equal to loyalty point redemption). So that’s $80/yr.
        • You get these nutrients in every pack: 100mL pH, 150g dry nutrient, 150g dry nutrient. Not sure exactly how the dry nutrients convert, or only 2/3, but assume I have to manually double this. So that’s another $78*0.5quantity*3times/yr*0.85discount = $100/yr.
        • Total $480/yr to stock a single triple rise garden. Then for the second garden it’s $320 for seeds (incl15% discount) and $200 for the nutrients. So total $800/yr.
      • So I’m saving >$500/yr, and getting a bunch of other perks for early access, welcome gifts, cheaper spot orders, birthday gifts, loyalty points, etc. Well worth it.
    • Quick sqlalchemy refresher:
      • db.session.query() returns a query
      • query.join() returns a query
      • query.filter() returns a query
      • query.all() returns a list of results
      • query.one() returns exactly one result, or raises an error if there’s 0 or multiple results
      • query.first() returns the first result of all results, or None if no results
      • query.scalar() returns the first element of the first result, or None if no results, or raises an error if multiple rows
    • “Result” above means an object (instance) of the class which defines the model for that result (whatever table you queried). If the query/results span multiple tables/models, then instead of single objects, it will be tuples of objects of the respective tables/models in the query/join.
    • “Element” is just the object if you’re querying a table. If you’re querying a specific col, scalar() will return the value of that col.
    • SBSC. Misc.
    • Cleaned up a ton of the ORM layer.
    • Removed the joins module, made explicit in the queries module.
    • Removed all type:ignore instances except the flask_user addition of user_manager to flask.current_app. Will be fixed later when I undepend on the yanked flask_user package.
    • Updated all my stubs. Just : Any specs for any objects (vars, classes, functions), structured in the module structure of the package. I’m not managing any members, args, params. Not worth it.