Commit bc096c11 by Daniel Light

Add custom vocab goal

parent 9c95d73e
Showing with 23 additions and 0 deletions
......@@ -12,3 +12,6 @@ $(base): ui
ui:
pyuic4 beetime/settings_layout.ui >beetime/settings_layout.py
local:
cp -r $(base).py beetime $(HOME)/Documents/Anki/addons
......@@ -39,3 +39,9 @@ where id > ?""", (col.sched.dayCutoff - 86400) * 1000)
def lookupAdded(col, added='cards'):
cardsAdded = col.db.scalar("select count() from %s where id > %d" % (added, (col.sched.dayCutoff - 86400) * 1000))
return cardsAdded
def addedTodayCutoff(col):
return (col.sched.dayCutoff - 86400) * 1000
def lookupGermanVocabAdded(col):
return col.db.scalar('SELECT count() from notes where id > ? and tags LIKE \"%german-vocabulary%\"', addedTodayCutoff(col))
......@@ -64,8 +64,22 @@ def syncDispatch(col=None, at=None):
prepareApiCall(col, reportTimestamp, numberAdded,
"added %d %s" % (numberAdded, added), goal_type='added')
germanVocabAdded = lookupGermanVocabAdded(col)
minimalApiCall(col, reportTimestamp, germanVocabAdded, 'anki-german-vocab')
mw.progress.finish()
def minimalApiCall(col, timestamp, value, slug):
user = col.conf[BEE]['username']
token = col.conf[BEE]['token']
data = {
"timestamp": timestamp,
"value": value,
"comment": "added %d" % (value),
"auth_token": token}
sendApi(user, token, slug, data)
def prepareApiCall(col, timestamp, value, comment, goal_type='time'):
"""Prepare the API call to beeminder.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment