Commit b2730117 by Vasyl Nakvasiuk

add total_count to answer from server

parent 66615cab
...@@ -8,11 +8,9 @@ If student have answered - words he entered and cloud. ...@@ -8,11 +8,9 @@ If student have answered - words he entered and cloud.
Stunent can change his answer. Stunent can change his answer.
""" """
import cgi
import json import json
import logging import logging
import re import re
from copy import deepcopy
from collections import OrderedDict from collections import OrderedDict
from lxml import etree from lxml import etree
...@@ -56,7 +54,11 @@ class WordCloudModule(WordCloudFields, XModule): ...@@ -56,7 +54,11 @@ class WordCloudModule(WordCloudFields, XModule):
if self.submitted: if self.submitted:
return json.dumps({ return json.dumps({
'status': 'success', 'status': 'success',
'student_words': self.student_words, 'student_words': {
word:self.all_words[word] for
word in self.student_words
},
'total_count': sum(self.all_words.values())
'top_words': self.prepare_words(self.top_words) 'top_words': self.prepare_words(self.top_words)
}) })
else: else:
...@@ -134,9 +136,6 @@ class WordCloudModule(WordCloudFields, XModule): ...@@ -134,9 +136,6 @@ class WordCloudModule(WordCloudFields, XModule):
self.all_words = temp_all_words self.all_words = temp_all_words
return self.get_state_json() return self.get_state_json()
elif dispatch == 'get_state':
return self.get_state_json()
else: else:
return json.dumps({ return json.dumps({
'status': 'fail', 'status': 'fail',
......
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 to comment