Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
f1d1a3f6
Commit
f1d1a3f6
authored
Apr 22, 2013
by
Vasyl Nakvasiuk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring after Python code review
parent
7b5d5a04
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
37 additions
and
17 deletions
+37
-17
common/lib/xmodule/xmodule/css/word_cloud/display.scss
+1
-1
common/lib/xmodule/xmodule/tests/test_import.py
+27
-6
common/lib/xmodule/xmodule/tests/test_logic.py
+2
-1
common/lib/xmodule/xmodule/word_cloud_module.py
+4
-4
common/test/data/word_cloud/conditional/condone.xml
+0
-3
common/test/data/word_cloud/sequential/Problem_Demos.xml
+2
-2
common/test/data/word_cloud/word_cloud/cloud.xml
+0
-0
lms/templates/word_cloud.html
+1
-0
No files found.
common/lib/xmodule/xmodule/css/word_cloud/display.scss
View file @
f1d1a3f6
.input-cloud
{
margin
:
5px
;
margin
:
5px
;
}
.result_cloud_section
{
...
...
common/lib/xmodule/xmodule/tests/test_import.py
View file @
f1d1a3f6
...
...
@@ -393,12 +393,31 @@ class ImportTestCase(BaseCourseTestCase):
self
.
assertEqual
(
len
(
sections
),
1
)
location
=
course
.
location
location
=
Location
(
conditional_location
=
Location
(
location
.
tag
,
location
.
org
,
location
.
course
,
'sequential'
,
'Problem_Demos'
'conditional'
,
'condone'
)
module
=
modulestore
.
get_instance
(
course
.
id
,
conditional_location
)
self
.
assertEqual
(
len
(
module
.
children
),
1
)
poll_location
=
Location
(
location
.
tag
,
location
.
org
,
location
.
course
,
'poll_question'
,
'first_poll'
)
module
=
modulestore
.
get_instance
(
course
.
id
,
poll_location
)
self
.
assertEqual
(
len
(
module
.
get_children
()),
0
)
self
.
assertEqual
(
module
.
voted
,
False
)
self
.
assertEqual
(
module
.
poll_answer
,
''
)
self
.
assertEqual
(
module
.
poll_answers
,
{})
self
.
assertEqual
(
module
.
answers
,
[
{
'text'
:
u'Yes'
,
'id'
:
'Yes'
},
{
'text'
:
u'No'
,
'id'
:
'No'
},
{
'text'
:
u"Don't know"
,
'id'
:
'Dont_know'
}
]
)
module
=
modulestore
.
get_instance
(
course
.
id
,
location
)
self
.
assertEqual
(
len
(
module
.
children
),
2
)
def
test_error_on_import
(
self
):
'''Check that when load_error_module is false, an exception is raised, rather than returning an ErrorModule'''
...
...
@@ -437,10 +456,12 @@ class ImportTestCase(BaseCourseTestCase):
location
=
course
.
location
location
=
Location
(
location
.
tag
,
location
.
org
,
location
.
course
,
'
sequential'
,
'Problem_Demos
'
'
word_cloud'
,
'cloud1
'
)
module
=
modulestore
.
get_instance
(
course
.
id
,
location
)
self
.
assertEqual
(
len
(
module
.
children
),
1
)
self
.
assertEqual
(
len
(
module
.
get_children
()),
0
)
self
.
assertEqual
(
module
.
num_inputs
,
'5'
)
self
.
assertEqual
(
module
.
num_top_words
,
'250'
)
def
test_cohort_config
(
self
):
"""
...
...
common/lib/xmodule/xmodule/tests/test_logic.py
View file @
f1d1a3f6
# -*- coding: utf-8 -*-
"""Test for Xmodule functional logic."""
import
json
import
unittest
...
...
@@ -89,7 +90,7 @@ class WordCloudModuleTest(LogicTest):
def
test_bad_ajax_request
(
self
):
# TODO: move top global test. Formalize all Xmodule errors.
# TODO: move top global test. Formalize all
our
Xmodule errors.
response
=
self
.
ajax_request
(
'bad_dispatch'
,
{})
self
.
assertDictEqual
(
response
,
{
'status'
:
'fail'
,
...
...
common/lib/xmodule/xmodule/word_cloud_module.py
View file @
f1d1a3f6
"""Word cloud is ungraded xblock used by students to
generate and view word cloud.
.
generate and view word cloud.
On the client side we show:
If student does not yet anwered -
five
text inputs.
If student does not yet anwered -
`num_inputs` numbers of
text inputs.
If student have answered - words he entered and cloud.
Stunent can change his answer.
"""
import
json
...
...
@@ -108,6 +106,7 @@ class WordCloudModule(WordCloudFields, XModule):
})
# Student words from client.
# FIXME: we must use raw JSON, not a post data (multipart/form-data)
raw_student_words
=
post
.
getlist
(
'student_words[]'
)
student_words
=
filter
(
None
,
map
(
self
.
good_word
,
raw_student_words
))
...
...
@@ -185,5 +184,6 @@ class WordCloudDescriptor(WordCloudFields, MakoModuleDescriptor, XmlDescriptor):
xml_object
=
etree
.
fromstring
(
xml_str
)
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
)
return
xml_object
common/test/data/word_cloud/conditional/condone.xml
deleted
100644 → 0
View file @
7b5d5a04
<conditional
attempted=
"True"
sources=
"i4x://HarvardX/ER22x/problem/choiceprob"
>
<html
url_name=
"secret_page"
/>
</conditional>
common/test/data/word_cloud/sequential/Problem_Demos.xml
View file @
f1d1a3f6
<sequential>
<vertical>
<word_cloud
display_name=
"cloud"
num_inputs=
"5"
num_top_words=
"250"
/>
<vertical
name=
"test_vertical"
>
<word_cloud
name=
"cloud1"
display_name=
"cloud"
num_inputs=
"5"
num_top_words=
"250"
/>
</vertical>
</sequential>
common/test/data/word_cloud/word_cloud/cloud.xml
0 → 100644
View file @
f1d1a3f6
lms/templates/word_cloud.html
View file @
f1d1a3f6
...
...
@@ -24,4 +24,5 @@
<h3>
Total number of words:
<span
class=
"total_num_words"
></span></h3>
<div
class=
"word_cloud"
></div>
</section>
</section>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment