Commit 116b07df by Anto Stupak Committed by Vasyl Nakvasiuk

word cloud: return percents. Attribute name is changed

parent 9006fd2b
......@@ -233,7 +233,7 @@ define('WordCloudMain', ['logme'], function (logme) {
}
$.each(response.student_words, function (word, stat) {
var percent = (response.display_percents) ? ' ' + (Math.round(100 * (stat / response.total_count))) + '%' : '';
var percent = (response.display_student_percents) ? ' ' + (Math.round(100 * (stat / response.total_count))) + '%' : '';
studentWordsKeys.push('<strong>' + word + '</strong>' + percent);
});
......
......@@ -30,7 +30,7 @@ class WordCloudFields(object):
display_name = String(help="Display name for this module", scope=Scope.settings)
num_inputs = Integer(help="Number of inputs", scope=Scope.settings, default=5)
num_top_words = Integer(help="Number of max words, which will be displayed.", scope=Scope.settings, default=250)
display_percents = Boolean(help="Dispaly usage percents for each word.", scope=Scope.settings, default=True)
display_student_percents = Boolean(help="Dispaly usage percents for each word.", scope=Scope.settings, default=True)
submitted = Boolean(help="Whether this student has posted words to the cloud", scope=Scope.user_state, default=False)
student_words = List(help="Student answer", scope=Scope.user_state, default=[])
......@@ -59,7 +59,7 @@ class WordCloudModule(WordCloudFields, XModule):
return json.dumps({
'status': 'success',
'submitted': True,
'display_percents': pretty_bool(self.display_percents),
'display_student_percents': pretty_bool(self.display_student_percents),
'student_words': {
word: self.all_words[word] for word in self.student_words
},
......@@ -70,7 +70,7 @@ class WordCloudModule(WordCloudFields, XModule):
return json.dumps({
'status': 'success',
'submitted': False,
'display_percents': False,
'display_student_percents': False,
'student_words': {},
'total_count': 0,
'top_words': {}
......@@ -194,6 +194,6 @@ class WordCloudDescriptor(WordCloudFields, MakoModuleDescriptor, XmlDescriptor):
xml_object.set('display_name', self.display_name)
xml_object.set('num_inputs', self.num_inputs)
xml_object.set('num_top_words', self.num_top_words)
xml_object.set('display_percents', pretty_bool(self.display_percents))
xml_object.set('display_student_percents', pretty_bool(self.display_student_percents))
return xml_object
......@@ -18,7 +18,7 @@ The following attributes can be specified for this tag::
[display_name| AUTOGENERATE] – Display name of xmodule. When this attribute is not defined - display name autogenerate with some hash.
[num_inputs| 5] – Number of inputs.
[num_top_words| 250] – Number of max words, which will be displayed.
[display_percents| True] – Dispaly usage percents for each word.
[display_student_percents| True] – Dispaly usage percents for each word.
.. note::
......
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