From b273011727bdd34fb2774f42799fc19353cf3622 Mon Sep 17 00:00:00 2001 From: Vasyl Nakvasiuk Date: Tue, 9 Apr 2013 18:44:53 +0300 Subject: [PATCH] add total_count to answer from server --- common/lib/xmodule/xmodule/word_cloud_module.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/common/lib/xmodule/xmodule/word_cloud_module.py b/common/lib/xmodule/xmodule/word_cloud_module.py index bdbe9e2970..77b55de0dc 100644 --- a/common/lib/xmodule/xmodule/word_cloud_module.py +++ b/common/lib/xmodule/xmodule/word_cloud_module.py @@ -8,11 +8,9 @@ If student have answered - words he entered and cloud. Stunent can change his answer. """ -import cgi import json import logging import re -from copy import deepcopy from collections import OrderedDict from lxml import etree @@ -56,7 +54,11 @@ class WordCloudModule(WordCloudFields, XModule): if self.submitted: return json.dumps({ '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) }) else: @@ -134,9 +136,6 @@ class WordCloudModule(WordCloudFields, XModule): self.all_words = temp_all_words return self.get_state_json() - - elif dispatch == 'get_state': - return self.get_state_json() else: return json.dumps({ 'status': 'fail',