@user_required
def get(self, user):
    ex = user.next_exercise()
    if ex:
        sentence_id = json.loads(ex.sentence.to_json())['id']
        word_id = json.loads(ex.word.to_json())['id']
        return {'id': word_id, 'word': ex.word.word, 'message': 'ok', 'cloze': ex.cloze, 'cn': ex.sentence.chn, 'sid': sentence_id, 'answers': [a for a in ex.answers], 'check': [hashlib.sha1(((a + sentence_id) + word_id).encode()).hexdigest() for a in ex.answers]}
    else:
        return ({'message': 'no word need exercise'}, 404)
@user_required
def get(self, user):
    ex = user.next_exercise()
    if ex:
        sentence_id = json.loads(ex.sentence.to_json())['id']
        word_id = json.loads(ex.word.to_json())['id']
        return {'id': word_id, 'word': ex.word.word, 'message': 'ok', 'cloze': ex.cloze, 'cn': ex.sentence.chn, 'sid': sentence_id, 'answers': [a for a in ex.answers], 'check': [hashlib.sha1(((a + sentence_id) + word_id).encode()).hexdigest() for a in ex.answers]}
    else:
        return ({'message': 'no word need exercise'}, 404)