Complete 975c069
fixes
This commit is contained in:
parent
9ba5c08c96
commit
da837b2d47
@ -819,22 +819,12 @@ class AnkiConnect:
|
|||||||
name = info['name']
|
name = info['name']
|
||||||
fields[name] = {'value': note.fields[order], 'order': order}
|
fields[name] = {'value': note.fields[order], 'order': order}
|
||||||
|
|
||||||
if getattr(card, 'question', None) is None:
|
|
||||||
question = card._getQA()['q']
|
|
||||||
else:
|
|
||||||
question = card.question(),
|
|
||||||
|
|
||||||
if getattr(card, 'answer', None) is None:
|
|
||||||
answer = card._getQA()['a']
|
|
||||||
else:
|
|
||||||
answer = card.answer()
|
|
||||||
|
|
||||||
result.append({
|
result.append({
|
||||||
'cardId': card.id,
|
'cardId': card.id,
|
||||||
'fields': fields,
|
'fields': fields,
|
||||||
'fieldOrder': card.ord,
|
'fieldOrder': card.ord,
|
||||||
'question': question,
|
'question': util.getQuestion(card),
|
||||||
'answer': answer,
|
'answer': util.getAnswer(card),
|
||||||
'modelName': model['name'],
|
'modelName': model['name'],
|
||||||
'deckName': self.deckNameFromId(card.did),
|
'deckName': self.deckNameFromId(card.did),
|
||||||
'css': model['css'],
|
'css': model['css'],
|
||||||
@ -1081,15 +1071,14 @@ class AnkiConnect:
|
|||||||
order = info['ord']
|
order = info['ord']
|
||||||
name = info['name']
|
name = info['name']
|
||||||
fields[name] = {'value': note.fields[order], 'order': order}
|
fields[name] = {'value': note.fields[order], 'order': order}
|
||||||
|
|
||||||
if card is not None:
|
if card is not None:
|
||||||
buttonList = reviewer._answerButtonList()
|
buttonList = reviewer._answerButtonList()
|
||||||
return {
|
return {
|
||||||
'cardId': card.id,
|
'cardId': card.id,
|
||||||
'fields': fields,
|
'fields': fields,
|
||||||
'fieldOrder': card.ord,
|
'fieldOrder': card.ord,
|
||||||
'question': card.question(),
|
'question': util.getQuestion(card),
|
||||||
'answer': card.answer(),
|
'answer': util.getAnswer(card),
|
||||||
'buttons': [b[0] for b in buttonList],
|
'buttons': [b[0] for b in buttonList],
|
||||||
'nextReviews': [reviewer.mw.col.sched.nextIvlStr(reviewer.card, b[0], True) for b in buttonList],
|
'nextReviews': [reviewer.mw.col.sched.nextIvlStr(reviewer.card, b[0], True) for b in buttonList],
|
||||||
'modelName': model['name'],
|
'modelName': model['name'],
|
||||||
|
@ -44,6 +44,22 @@ def api(*versions):
|
|||||||
return decorator
|
return decorator
|
||||||
|
|
||||||
|
|
||||||
|
def getQuestion(card):
|
||||||
|
if getattr(card, 'question', None) is None:
|
||||||
|
question = card._getQA()['q']
|
||||||
|
else:
|
||||||
|
question = card.question(),
|
||||||
|
return question
|
||||||
|
|
||||||
|
|
||||||
|
def getAnswer(card):
|
||||||
|
if getattr(card, 'answer', None) is None:
|
||||||
|
answer = card._getQA()['a']
|
||||||
|
else:
|
||||||
|
answer = card.answer()
|
||||||
|
return answer
|
||||||
|
|
||||||
|
|
||||||
def setting(key):
|
def setting(key):
|
||||||
defaults = {
|
defaults = {
|
||||||
'apiKey': None,
|
'apiKey': None,
|
||||||
|
Loading…
Reference in New Issue
Block a user