exposing more information about note fields (#11)

This commit is contained in:
Alex Yatskov 2017-07-05 13:01:13 -07:00
parent c0d8d7f029
commit da7c1c8a45
2 changed files with 15 additions and 5 deletions

View File

@ -479,16 +479,19 @@ class AnkiBridge:
fields = {}
for info in model['flds']:
fields[info['name']] = note.fields[info['ord']]
order = info['ord']
name = info['name']
fields[name] = {'value': note.fields[order], 'order': order}
if card is not None:
return {
'cardId': card.id,
'fields': fields,
'fieldOrder': card.ord,
'question': card._getQA()['q'],
'answer': card._getQA()['a'],
'buttons': map(lambda b: b[0], self.window().reviewer._answerButtonList()),
'modelName': card.model()['name'],
'buttons': map(lambda b: b[0], reviewer._answerButtonList()),
'modelName': model['name'],
'deckName': self.deckNameFromId(card.did)
}

View File

@ -334,9 +334,16 @@ Below is a list of currently supported actions. Requests with invalid actions or
"question": "front content",
"deckName": "Default",
"modelName": "Basic",
"fieldOrder": 0,
"fields": {
"Front": "front content",
"Back": "back content"
"Front": {
"value": "front content",
"order": 0
},
"Back": {
"value": "back content",
"order": 1
}
},
"cardId": 1498938915662,
"buttons": [1, 2, 3]