Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
X
xblock-drag-and-drop-v2
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
OpenEdx
xblock-drag-and-drop-v2
Commits
24c6ceda
Commit
24c6ceda
authored
Oct 18, 2016
by
Tim Krones
Committed by
GitHub
Oct 18, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #106 from arbrandes/final_state
Don't delete misplaced items on final attempt
parents
45b0e1a6
3a91a7ce
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
2 deletions
+54
-2
.travis.yml
+1
-1
Changelog.md
+5
-0
drag_and_drop_v2/drag_and_drop_v2.py
+2
-0
setup.py
+1
-1
tests/integration/test_interaction_assessment.py
+30
-0
tests/unit/test_advanced.py
+15
-0
No files found.
.travis.yml
View file @
24c6ceda
...
...
@@ -9,7 +9,7 @@ install:
-
"
sh
install_test_deps.sh"
-
"
pip
uninstall
-y
xblock-drag-and-drop-v2"
-
"
python
setup.py
sdist"
-
"
pip
install
dist/xblock-drag-and-drop-v2-2.0.1
0
.tar.gz"
-
"
pip
install
dist/xblock-drag-and-drop-v2-2.0.1
1
.tar.gz"
script
:
-
pep8 drag_and_drop_v2 tests --max-line-length=120
-
pylint drag_and_drop_v2
...
...
Changelog.md
View file @
24c6ceda
Version 2.0.11 (2016-10-03)
---------------------------
*
(
[
#106
](
https://github.com/edx-solutions/xblock-drag-and-drop-v2/pull/106
)
) Don't delete misplaced items on final attempt
Version 2.0.10 (2016-09-22)
---------------------------
...
...
drag_and_drop_v2/drag_and_drop_v2.py
View file @
24c6ceda
...
...
@@ -403,6 +403,8 @@ class DragAndDropBlock(XBlock, XBlockWithSettingsMixin, ThemableXBlockMixin):
misplaced_items
=
[]
for
item_id
in
misplaced_ids
:
# Don't delete misplaced item states on the final attempt.
if
self
.
attempts_remain
:
del
self
.
item_state
[
item_id
]
misplaced_items
.
append
(
self
.
_get_item_definition
(
int
(
item_id
)))
...
...
setup.py
View file @
24c6ceda
...
...
@@ -23,7 +23,7 @@ def package_data(pkg, root_list):
setup
(
name
=
'xblock-drag-and-drop-v2'
,
version
=
'2.0.1
0
'
,
version
=
'2.0.1
1
'
,
description
=
'XBlock - Drag-and-Drop v2'
,
packages
=
[
'drag_and_drop_v2'
],
install_requires
=
[
...
...
tests/integration/test_interaction_assessment.py
View file @
24c6ceda
...
...
@@ -139,6 +139,36 @@ class AssessmentInteractionTest(
for
item_id
in
misplaced_items
:
self
.
assert_reverted_item
(
item_id
)
def
test_misplaced_items_not_returned_to_bank_on_final_attempt
(
self
):
"""
Test items placed on incorrect zones are not returned to item bank
after submitting solution on the final attempt, and remain placed after
subsequently refreshing the page.
"""
self
.
place_item
(
0
,
TOP_ZONE_ID
,
action_key
=
Keys
.
RETURN
)
# Reach final attempt
for
_
in
xrange
(
self
.
MAX_ATTEMPTS
-
1
):
self
.
click_submit
()
# Place incorrect item on final attempt
self
.
place_item
(
1
,
TOP_ZONE_ID
,
action_key
=
Keys
.
RETURN
)
self
.
click_submit
()
# Incorrect item remains placed
def
_assert_placed
(
item_id
,
zone_title
):
item
=
self
.
_get_placed_item_by_value
(
item_id
)
item_description
=
item
.
find_element_by_css_selector
(
'.sr'
)
self
.
assertEqual
(
item_description
.
text
,
'Placed in: {}'
.
format
(
zone_title
))
_assert_placed
(
1
,
TOP_ZONE_TITLE
)
# Refresh the page
self
.
_page
=
self
.
go_to_page
(
self
.
PAGE_TITLE
)
# Incorrect item remains placed after refresh
_assert_placed
(
1
,
TOP_ZONE_TITLE
)
def
test_max_attempts_reached_submit_and_reset_disabled
(
self
):
"""
Test "Submit" and "Reset" buttons are disabled when no more attempts remaining
...
...
tests/unit/test_advanced.py
View file @
24c6ceda
...
...
@@ -404,6 +404,21 @@ class AssessmentModeFixture(BaseDragAndDropAjaxFixture):
expected_message
=
self
.
_make_feedback_message
(
self
.
FINAL_FEEDBACK
)
self
.
assertIn
(
expected_message
,
res
[
self
.
OVERALL_FEEDBACK_KEY
])
def
test_do_attempt_does_not_delete_misplaced_items_at_last_attempt
(
self
):
"""
Upon submitting the final attempt, test that misplaced items are not
deleted from the item state.
"""
self
.
_set_final_attempt
()
misplaced_ids
=
self
.
_submit_incorrect_solution
()
self
.
call_handler
(
self
.
DO_ATTEMPT_HANDLER
,
data
=
{})
self
.
assertFalse
(
self
.
block
.
attempts_remain
)
# precondition check
for
i
in
misplaced_ids
:
self
.
assertIn
(
str
(
i
),
self
.
block
.
item_state
.
keys
())
def
test_get_user_state_does_not_include_correctness
(
self
):
self
.
_submit_complete_solution
()
original_item_state
=
self
.
block
.
item_state
...
...
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