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
b7be0402
Commit
b7be0402
authored
Jan 03, 2013
by
Alexander Kryklia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated case when no rule is processed
parent
aaf54c56
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
12 deletions
+6
-12
common/lib/capa/capa/graders/draganddrop.py
+6
-12
No files found.
common/lib/capa/capa/graders/draganddrop.py
View file @
b7be0402
...
...
@@ -142,28 +142,22 @@ class DragAndDrop(object):
# from now self.correct_groups and self.user_groups are equal if
# order is ignored
#
Checks
in every group that user positions of every element are equal
#
Next check
in every group that user positions of every element are equal
# with correct positions for every rule
# for group in self.correct_groups: # 'denied' rule
# if not self.compare_positions(self.correct_positions[group].get(
# 'denied', []), self.user_positions[group]['user'], flag='denied'):
# return False
passed_rules
=
dict
()
for
rule
in
(
'exact'
,
'anyof'
):
passed_rules
[
rule
]
=
True
passed_rules
[
rule
]
=
0
for
groupname
in
self
.
correct_groups
:
if
self
.
correct_positions
[
groupname
]
.
get
(
rule
,
[]):
if
not
self
.
compare_positions
(
self
.
correct_positions
[
groupname
][
rule
],
self
.
user_positions
[
groupname
][
'user'
],
flag
=
rule
):
return
False
else
:
passed_rules
[
rule
]
=
False
passed_rules
[
rule
]
+=
1
# if
all passed rules are false
if
not
reduce
(
lambda
x
,
y
:
x
or
y
,
passed_rules
)
:
# if
no rule was executed for all groups
if
sum
(
passed_rules
.
values
())
==
0
:
return
False
return
True
...
...
@@ -201,7 +195,7 @@ class DragAndDrop(object):
def
populate
(
self
,
correct_answer
,
user_answer
):
""" """
# convert from dict format to list format
# convert from dict
answer
format to list format
if
isinstance
(
correct_answer
,
dict
):
tmp
=
[]
for
key
,
value
in
correct_answer
.
items
():
...
...
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