Skip to content

Commit

Permalink
testing fix for the anki 2.1.25 update
Browse files Browse the repository at this point in the history
  • Loading branch information
Saul Crumpton committed May 5, 2020
1 parent 694250d commit 2fd0e59
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
20 changes: 12 additions & 8 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ def new_cards_in_deck(deck_id):

# Find settings group ID
def find_settings_group_id(name):
dconf = mw.col.decks.dconf
dconf = mw.col.decks.all_config()
for k in dconf:
if dconf[k]['name'] == name:
return k
if k['name'] == name:
return k['id']
# All I want is the group ID
return False


Expand Down Expand Up @@ -128,11 +129,14 @@ def cards_per_day(new_cards, days_left):
def update_new_cards_per_day(name, per_day):
group_id = find_settings_group_id(name)
if group_id:
if group_id in mw.col.decks.dconf:
mw.col.decks.dconf[group_id]["new"]["perDay"] = int(per_day)
# utils.showInfo("updating deadlines disabled")
mw.col.decks.save(mw.col.decks.dconf[group_id])
#mw.col.decks.flush()
# if we have a group id; check all of thr available confs
for dconf in mw.col.decks.all_config():
if (group_id==dconf.get('id')):
# if I found the config that I'm trying to update, updat ethe config
dconf["new"]["perDay"] = int(per_day)
# utils.showInfo("updating deadlines disabled")
mw.col.decks.save(dconf)
#mw.col.decks.flush()


# Calc new cards per day
Expand Down
6 changes: 3 additions & 3 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,11 @@ def readValues(self):
self.date=""
self.fillFields()
mw.addonManager.writeConfig(__name__, self.deadlines)
dconf = mw.col.decks.dconf
dconf = mw.col.decks.all_config()
tempID=0
for confId,conf in dconf.items():
for conf in dconf:
if(conf['name']==deck):
tempID=confId
tempID=conf['id']
if(tempID==0):
tempID = mw.col.decks.confId(deck)
mw.col.decks.byName(deck)['conf']=tempID
Expand Down

0 comments on commit 2fd0e59

Please sign in to comment.