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
77ed9216
Commit
77ed9216
authored
Mar 04, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prelim wiring on peer grading and combined open ended xmodules
parent
02539a3b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
27 deletions
+36
-27
common/lib/xmodule/xmodule/combined_open_ended_module.py
+22
-13
common/lib/xmodule/xmodule/peer_grading_module.py
+14
-14
No files found.
common/lib/xmodule/xmodule/combined_open_ended_module.py
View file @
77ed9216
...
...
@@ -6,13 +6,18 @@ from pkg_resources import resource_string
from
xmodule.raw_module
import
RawDescriptor
from
.x_module
import
XModule
from
xblock.core
import
Integer
,
Scope
,
BlockScope
,
ModelType
,
String
,
Boolean
,
Object
,
Float
from
xmodule.open_ended_grading_classes.combined_open_ended_modulev1
import
CombinedOpenEndedV1Module
,
CombinedOpenEndedV1Descriptor
log
=
logging
.
getLogger
(
"mitx.courseware"
)
V1_ATTRIBUTES
=
[
"display_name"
,
"current_task_number"
,
"task_states"
,
"state"
,
"attempts"
,
"ready_to_reset"
,
"max_attempts"
,
"is_graded"
,
"accept_file_upload"
,
"skip_spelling_checks"
,
"due"
,
"graceperiod"
,
"max_score"
,
"data"
]
VERSION_TUPLES
=
(
(
'1'
,
CombinedOpenEndedV1Descriptor
,
CombinedOpenEndedV1Module
),
(
'1'
,
CombinedOpenEndedV1Descriptor
,
CombinedOpenEndedV1Module
,
V1_ATTRIBUTES
),
)
DEFAULT_VERSION
=
1
...
...
@@ -51,19 +56,20 @@ class CombinedOpenEndedModule(XModule):
icon_class
=
'problem'
display_name
=
String
(
help
=
"Display name for this module"
,
scope
=
Scope
.
settings
)
current_task_number
=
Integer
(
help
=
"Current task that the student is on."
,
default
=
0
,
scope
=
Scope
.
student_state
)
task_states
=
String
(
help
=
"State dictionaries of each task within this module."
,
default
=
json
.
dumps
(
"[]"
),
scope
=
Scope
.
student_state
)
state
=
String
(
help
=
"Which step within the current task that the student is on."
,
default
=
"initial"
,
scope
=
Scope
.
student_state
)
attempts
=
Integer
(
help
=
"Number of attempts taken by the student on this problem"
,
default
=
0
,
scope
=
Scope
.
student_state
)
max_attempts
=
StringyInteger
(
help
=
"Maximum number of attempts that a student is allowed"
,
scope
=
Scope
.
settings
)
due
=
String
(
help
=
"Date that this problem is due by"
,
scope
=
Scope
.
settings
)
graceperiod
=
Timedelta
(
help
=
"Amount of time after the due date that submissions will be accepted"
,
scope
=
Scope
.
settings
)
showanswer
=
String
(
help
=
"When to show the problem answer to the student"
,
scope
=
Scope
.
settings
,
default
=
"closed"
)
force_save_button
=
Boolean
(
help
=
"Whether to force the save button to appear on the page"
,
scope
=
Scope
.
settings
,
default
=
False
)
rerandomize
=
Randomization
(
help
=
"When to rerandomize the problem"
,
default
=
"always"
,
scope
=
Scope
.
settings
)
ready_to_reset
=
Boolean
(
help
=
"If the problem is ready to be reset or not."
,
default
=
False
,
scope
=
Scope
.
student_state
)
max_attempts
=
Integer
(
help
=
"Maximum number of attempts that a student is allowed."
,
default
=
1
,
scope
=
Scope
.
settings
)
is_graded
=
Boolean
(
help
=
"Whether or not the problem is graded."
,
default
=
False
,
scope
=
Scope
.
settings
)
accept_file_upload
=
Boolean
(
help
=
"Whether or not the problem accepts file uploads."
,
default
=
False
,
scope
=
Scope
.
settings
)
skip_spelling_checks
=
Boolean
(
help
=
"Whether or not to skip initial spelling checks."
,
default
=
True
,
scope
=
Scope
.
settings
)
due
=
String
(
help
=
"Date that this problem is due by"
,
default
=
None
,
scope
=
Scope
.
settings
)
graceperiod
=
String
(
help
=
"Amount of time after the due date that submissions will be accepted"
,
default
=
None
,
scope
=
Scope
.
settings
)
max_score
=
Integer
(
help
=
"Maximum score for the problem."
,
default
=
1
,
scope
=
Scope
.
settings
)
data
=
String
(
help
=
"XML data for the problem"
,
scope
=
Scope
.
content
)
correct_map
=
Object
(
help
=
"Dictionary with the correctness of current student answers"
,
scope
=
Scope
.
student_state
,
default
=
{})
student_answers
=
Object
(
help
=
"Dictionary with the current student responses"
,
scope
=
Scope
.
student_state
)
done
=
Boolean
(
help
=
"Whether the student has answered the problem"
,
scope
=
Scope
.
student_state
)
display_name
=
String
(
help
=
"Display name for this module"
,
scope
=
Scope
.
settings
)
seed
=
Integer
(
help
=
"Random seed for this student"
,
scope
=
Scope
.
student_state
)
js
=
{
'coffee'
:
[
resource_string
(
__name__
,
'js/src/combinedopenended/display.coffee'
),
resource_string
(
__name__
,
'js/src/collapsible.coffee'
),
...
...
@@ -133,6 +139,7 @@ class CombinedOpenEndedModule(XModule):
versions
=
[
i
[
0
]
for
i
in
VERSION_TUPLES
]
descriptors
=
[
i
[
1
]
for
i
in
VERSION_TUPLES
]
modules
=
[
i
[
2
]
for
i
in
VERSION_TUPLES
]
attributes
=
[
i
[
3
]
for
i
in
VERSION_TUPLES
]
try
:
version_index
=
versions
.
index
(
self
.
version
)
...
...
@@ -146,8 +153,10 @@ class CombinedOpenEndedModule(XModule):
'rewrite_content_links'
:
self
.
rewrite_content_links
,
}
instance_state
=
{
k
:
self
.
__dict__
[
k
]
for
k
in
self
.
__dict__
if
k
in
attributes
[
version_index
]}
log
.
debug
(
instance_state
)
self
.
child_descriptor
=
descriptors
[
version_index
](
self
.
system
)
self
.
child_definition
=
descriptors
[
version_index
]
.
definition_from_xml
(
etree
.
fromstring
(
definition
[
'data'
]
),
self
.
system
)
self
.
child_definition
=
descriptors
[
version_index
]
.
definition_from_xml
(
etree
.
fromstring
(
self
.
data
),
self
.
system
)
self
.
child_module
=
modules
[
version_index
](
self
.
system
,
location
,
self
.
child_definition
,
self
.
child_descriptor
,
instance_state
=
json
.
dumps
(
instance_state
),
metadata
=
self
.
metadata
,
static_data
=
static_data
)
...
...
common/lib/xmodule/xmodule/peer_grading_module.py
View file @
77ed9216
...
...
@@ -40,14 +40,16 @@ class PeerGradingModule(XModule):
css
=
{
'scss'
:
[
resource_string
(
__name__
,
'css/combinedopenended/display.scss'
)]}
student_data_for_location
=
Object
(
scope
=
Scope
.
student_state
)
max_grade
=
Integer
(
default
=
MAX_SCORE
,
scope
=
Scope
.
student_state
)
use_for_single_location
=
Boolean
(
default
=
USE_FOR_SINGLE_LOCATION
,
scope
=
Scope
.
settings
)
is_graded
=
Boolean
(
default
=
IS_GRADED
,
scope
=
Scope
.
settings
)
link_to_location
=
String
(
default
=
LINK_TO_LOCATION
,
scope
=
Scope
.
settings
)
use_for_single_location
=
Boolean
(
help
=
"Whether to use this for a single location or as a panel."
,
default
=
USE_FOR_SINGLE_LOCATION
,
scope
=
Scope
.
settings
)
link_to_location
=
String
(
help
=
"The location this problem is linked to."
,
default
=
LINK_TO_LOCATION
,
scope
=
Scope
.
settings
)
is_graded
=
Boolean
(
help
=
"Whether or not this module is scored."
,
default
=
IS_GRADED
,
scope
=
Scope
.
settings
)
display_due_date_string
=
String
(
help
=
"Due date that should be displayed."
,
default
=
None
,
scope
=
Scope
.
settings
)
grace_period_string
=
String
(
help
=
"Amount of grace to give on the due date."
,
default
=
None
,
scope
=
Scope
.
settings
)
max_grade
=
Integer
(
help
=
"The maximum grade that a student can receieve for this problem."
,
default
=
MAX_SCORE
,
scope
=
Scope
.
settings
)
student_data_for_location
=
Object
(
help
=
"Student data for a given peer grading problem."
,
default
=
json
.
dumps
({}),
scope
=
Scope
.
student_state
)
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
PeerGradingModule
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
def
__init__
(
self
,
system
,
location
,
descriptor
,
model_data
):
XModule
.
__init__
(
self
,
system
,
location
,
descriptor
,
model_data
)
#We need to set the location here so the child modules can use it
system
.
set
(
'location'
,
location
)
...
...
@@ -57,11 +59,9 @@ class PeerGradingModule(XModule):
else
:
self
.
peer_gs
=
MockPeerGradingService
()
if
isinstance
(
self
.
use_for_single_location
,
basestring
):
self
.
use_for_single_location
=
(
self
.
use_for_single_location
in
TRUE_DICT
)
self
.
link_to_location
=
self
.
metadata
.
get
(
'link_to_location'
,
USE_FOR_SINGLE_LOCATION
)
if
self
.
use_for_single_location
==
True
:
try
:
self
.
linked_problem
=
modulestore
()
.
get_instance
(
self
.
system
.
course_id
,
self
.
link_to_location
)
...
...
@@ -73,21 +73,21 @@ class PeerGradingModule(XModule):
if
due_date
:
self
.
metadata
[
'due'
]
=
due_date
self
.
is_graded
=
self
.
metadata
.
get
(
'is_graded'
,
IS_GRADED
)
if
isinstance
(
self
.
is_graded
,
basestring
):
self
.
is_graded
=
(
self
.
is_graded
in
TRUE_DICT
)
display_due_date_string
=
self
.
metadata
.
get
(
'due'
,
None
)
grace_period_string
=
self
.
metadata
.
get
(
'graceperiod'
,
None
)
try
:
self
.
timeinfo
=
TimeInfo
(
display_due_date_string
,
grace_period_string
)
self
.
timeinfo
=
TimeInfo
(
self
.
display_due_date_string
,
self
.
grace_period_string
)
except
:
log
.
error
(
"Error parsing due date information in location {0}"
.
format
(
location
))
raise
self
.
display_due_date
=
self
.
timeinfo
.
display_due_date
try
:
self
.
student_data_for_location
=
json
.
loads
(
self
.
student_data_for_location
)
except
:
pass
self
.
ajax_url
=
self
.
system
.
ajax_url
if
not
self
.
ajax_url
.
endswith
(
"/"
):
...
...
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