Last active
April 23, 2017 01:46
-
-
Save cjauvin/b4aa0a69170f30faf2b1d0fd673184da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import datetime as dt | |
import json | |
import os | |
N_PER_BOX = 30 | |
path = os.path.dirname(os.path.realpath(__file__)) | |
with open('%s/truth.json' % path) as f: | |
a = json.load(f) | |
d0 = dt.datetime.strptime( | |
next(iter(a['n_remaining_at_date_before_morning_intake'].keys())), | |
'%Y-%m-%d' | |
) | |
n0 = next(iter(a['n_remaining_at_date_before_morning_intake'].values())) | |
n_days_since = (dt.datetime.today() - d0).days | |
n_should_remain = (n0 - n_days_since) % N_PER_BOX or N_PER_BOX | |
print('%d should remain in box before morning intake' % n_should_remain) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment