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
27dcf96e
Commit
27dcf96e
authored
Aug 20, 2014
by
dragonfi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add completed flag to only publish the grade once
parent
f0215eec
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletions
+10
-1
drag_and_drop_v2/drag_and_drop_v2.py
+10
-1
No files found.
drag_and_drop_v2/drag_and_drop_v2.py
View file @
27dcf96e
...
...
@@ -10,7 +10,7 @@ import copy
import
urllib
from
xblock.core
import
XBlock
from
xblock.fields
import
Scope
,
String
,
Dict
,
Float
from
xblock.fields
import
Scope
,
String
,
Dict
,
Float
,
Boolean
from
xblock.fragment
import
Fragment
from
.utils
import
render_template
,
load_resource
...
...
@@ -62,6 +62,12 @@ class DragAndDropBlock(XBlock):
default
=
{}
)
completed
=
Boolean
(
help
=
"The student has completed the problem at least once"
,
scope
=
Scope
.
user_state
,
default
=
False
)
has_score
=
True
def
student_view
(
self
,
context
):
...
...
@@ -173,6 +179,9 @@ class DragAndDropBlock(XBlock):
if
self
.
_is_finished
():
final_feedback
=
self
.
data
[
'feedback'
][
'finish'
]
# only publish the grade once
if
not
self
.
completed
:
self
.
completed
=
True
try
:
self
.
runtime
.
publish
(
self
,
'grade'
,
{
'value'
:
len
(
self
.
item_state
)
/
float
(
tot_items
)
*
self
.
weight
,
...
...
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