ocdevel / gnothi

Gnothi is an open-source AI journal and toolkit for self-discovery. If you're interested in getting involved, we'd love to hear from you.

Home Page:https://gnothiai.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Habitica: when in the inn, don't record values

lefnire opened this issue · comments

I'm syncing Habitica on cron. If the user is checked into the inn, it still pulls the values - which will all be "unchecked" values (0, or -1, etc). On Habitica, those bad values don't matter; it just skips. But on Gnothi, it still pulls those bad values. Do a check, if user.in_the_inn then enter null values, or don't skip the cron job entirely. Gnothi is ok with null values for missed days.

I think it's as simple as

index 13678c1..6cd6909 100644
--- a/server/app/habitica.py
+++ b/server/app/habitica.py
@@ -26,10 +26,13 @@ def sync_for(user):
         headers=headers
     ).json()['data']
     huser = requests.get(
-        'https://habitica.com/api/v3/user?userFields=lastCron,needsCron',
+        'https://habitica.com/api/v3/user?userFields=lastCron,needsCron,preferences',
         headers=headers
     ).json()['data']

+    # don't pull field if they're in the inn
+    if huser['preferences']['sleep']: return
+
     # Use SQL to determine day, so not managing timezones in python + sql
     tz = M.User.tz(db.session, user.id)
     last_cron = db.session.execute(text("""

But gotta think on this. Do we want to disable pulling fields if they're in the inn? Arguments for/against:

  • Don't pull fields. Might skew the data, the non-recorded values on Habitica aren't your typical behavior, and could mess up Influencers
  • Do pull fields. What if you want to record things while you're in the inn?... well... why would you do that... or what if you record Gnothi custom field entries, but not Habitica.

Acutally, I think it's pretty clear to not sync Habitica while in the inn. I'll just submit this comment in case anyone wants to discuss.

Personally I would rather want there to remain an option to record things while in the inn.

Moving away from Habitica #185