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
480e97a3
Commit
480e97a3
authored
Jul 18, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup and change attribute names
parent
d17486a9
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
98 deletions
+34
-98
common/lib/xmodule/xmodule/combined_open_ended_module.py
+16
-39
common/lib/xmodule/xmodule/open_ended_grading_classes/combined_open_ended_modulev1.py
+4
-34
common/lib/xmodule/xmodule/peer_grading_module.py
+14
-25
No files found.
common/lib/xmodule/xmodule/combined_open_ended_module.py
View file @
480e97a3
...
...
@@ -13,7 +13,7 @@ import textwrap
log
=
logging
.
getLogger
(
"mitx.courseware"
)
V1_SETTINGS_ATTRIBUTES
=
[
"display_name"
,
"
attempts"
,
"is_
graded"
,
"accept_file_upload"
,
V1_SETTINGS_ATTRIBUTES
=
[
"display_name"
,
"
max_attempts"
,
"
graded"
,
"accept_file_upload"
,
"skip_spelling_checks"
,
"due"
,
"graceperiod"
,
"weight"
]
V1_STUDENT_ATTRIBUTES
=
[
"current_task_number"
,
"task_states"
,
"state"
,
...
...
@@ -172,7 +172,7 @@ class CombinedOpenEndedFields(object):
display_name
=
String
(
display_name
=
"Display Name"
,
help
=
"This name appears in the horizontal navigation at the top of the page."
,
default
=
"Open
Ended Grading
"
,
default
=
"Open
Response Assessment
"
,
scope
=
Scope
.
settings
)
current_task_number
=
Integer
(
...
...
@@ -189,6 +189,12 @@ class CombinedOpenEndedFields(object):
default
=
"initial"
,
scope
=
Scope
.
user_state
)
graded
=
Boolean
(
display_name
=
"Graded"
,
help
=
'Defines whether the student gets credit for grading this problem.'
,
default
=
False
,
scope
=
Scope
.
settings
)
student_attempts
=
Integer
(
help
=
"Number of attempts taken by the student on this problem"
,
default
=
0
,
...
...
@@ -199,19 +205,13 @@ class CombinedOpenEndedFields(object):
default
=
False
,
scope
=
Scope
.
user_state
)
attempts
=
Integer
(
max_
attempts
=
Integer
(
display_name
=
"Maximum Attempts"
,
help
=
"The number of times the student can try to answer this problem."
,
default
=
1
,
scope
=
Scope
.
settings
,
values
=
{
"min"
:
1
}
)
is_graded
=
Boolean
(
display_name
=
"Graded"
,
help
=
"Whether or not the problem is graded."
,
default
=
False
,
scope
=
Scope
.
settings
)
accept_file_upload
=
Boolean
(
display_name
=
"Allow File Uploads"
,
help
=
"Whether or not the student can submit files as a response."
,
...
...
@@ -339,37 +339,9 @@ class CombinedOpenEndedModule(CombinedOpenEndedFields, XModule):
def
__init__
(
self
,
*
args
,
**
kwargs
):
"""
Definition file should have one or many task blocks, a rubric block, and a prompt block
:
Definition file should have one or many task blocks, a rubric block, and a prompt block
.
Sample file:
<combinedopenended attempts="10000">
<rubric>
Blah blah rubric.
</rubric>
<prompt>
Some prompt.
</prompt>
<task>
<selfassessment>
<hintprompt>
What hint about this problem would you give to someone?
</hintprompt>
<submitmessage>
Save Succcesful. Thanks for participating!
</submitmessage>
</selfassessment>
</task>
<task>
<openended min_score_to_attempt="1" max_score_to_attempt="1">
<openendedparam>
<initial_display>Enter essay here.</initial_display>
<answer_display>This is the answer.</answer_display>
<grader_payload>{"grader_settings" : "ml_grading.conf",
"problem_id" : "6.002x/Welcome/OETest"}</grader_payload>
</openendedparam>
</openended>
</task>
</combinedopenended>
See DEFAULT_DATA for a sample.
"""
XModule
.
__init__
(
self
,
*
args
,
**
kwargs
)
...
...
@@ -450,6 +422,11 @@ class CombinedOpenEndedDescriptor(CombinedOpenEndedFields, RawDescriptor):
js_module_name
=
"OpenEndedMarkdownEditingDescriptor"
css
=
{
'scss'
:
[
resource_string
(
__name__
,
'css/editor/edit.scss'
),
resource_string
(
__name__
,
'css/combinedopenended/edit.scss'
)]}
metadata_translations
=
{
'is_graded'
:
'graded'
,
'attempts'
:
'max_attempts'
,
}
def
get_context
(
self
):
_context
=
RawDescriptor
.
get_context
(
self
)
_context
.
update
({
'markdown'
:
self
.
markdown
,
...
...
common/lib/xmodule/xmodule/open_ended_grading_classes/combined_open_ended_modulev1.py
View file @
480e97a3
...
...
@@ -78,37 +78,7 @@ class CombinedOpenEndedV1Module():
instance_state
=
None
,
shared_state
=
None
,
metadata
=
None
,
static_data
=
None
,
**
kwargs
):
"""
Definition file should have one or many task blocks, a rubric block, and a prompt block:
Sample file:
<combinedopenended attempts="10000">
<rubric>
Blah blah rubric.
</rubric>
<prompt>
Some prompt.
</prompt>
<task>
<selfassessment>
<hintprompt>
What hint about this problem would you give to someone?
</hintprompt>
<submitmessage>
Save Succcesful. Thanks for participating!
</submitmessage>
</selfassessment>
</task>
<task>
<openended min_score_to_attempt="1" max_score_to_attempt="1">
<openendedparam>
<initial_display>Enter essay here.</initial_display>
<answer_display>This is the answer.</answer_display>
<grader_payload>{"grader_settings" : "ml_grading.conf",
"problem_id" : "6.002x/Welcome/OETest"}</grader_payload>
</openendedparam>
</openended>
</task>
</combinedopenended>
Definition file should have one or many task blocks, a rubric block, and a prompt block. See DEFAULT_DATA in combined_open_ended_module for a sample.
"""
...
...
@@ -131,8 +101,8 @@ class CombinedOpenEndedV1Module():
# Allow reset is true if student has failed the criteria to move to the next child task
self
.
ready_to_reset
=
instance_state
.
get
(
'ready_to_reset'
,
False
)
self
.
attempts
=
self
.
instance_state
.
get
(
'
attempts'
,
MAX_ATTEMPTS
)
self
.
is_scored
=
self
.
instance_state
.
get
(
'
is_
graded'
,
IS_SCORED
)
in
TRUE_DICT
self
.
max_attempts
=
self
.
instance_state
.
get
(
'max_
attempts'
,
MAX_ATTEMPTS
)
self
.
is_scored
=
self
.
instance_state
.
get
(
'graded'
,
IS_SCORED
)
in
TRUE_DICT
self
.
accept_file_upload
=
self
.
instance_state
.
get
(
'accept_file_upload'
,
ACCEPT_FILE_UPLOAD
)
in
TRUE_DICT
self
.
skip_basic_checks
=
self
.
instance_state
.
get
(
'skip_spelling_checks'
,
SKIP_BASIC_CHECKS
)
in
TRUE_DICT
...
...
@@ -153,7 +123,7 @@ class CombinedOpenEndedV1Module():
# Static data is passed to the child modules to render
self
.
static_data
=
{
'max_score'
:
self
.
_max_score
,
'max_attempts'
:
self
.
attempts
,
'max_attempts'
:
self
.
max_
attempts
,
'prompt'
:
definition
[
'prompt'
],
'rubric'
:
definition
[
'rubric'
],
'display_name'
:
self
.
display_name
,
...
...
common/lib/xmodule/xmodule/peer_grading_module.py
View file @
480e97a3
...
...
@@ -19,32 +19,27 @@ from django.utils.timezone import UTC
log
=
logging
.
getLogger
(
__name__
)
USE_FOR_SINGLE_LOCATION
=
False
LINK_TO_LOCATION
=
""
MAX_SCORE
=
1
IS_GRADED
=
False
EXTERNAL_GRADER_NO_CONTACT_ERROR
=
"Failed to contact external graders. Please notify course staff."
class
PeerGradingFields
(
object
):
use_for_single_location
=
Boolean
(
display_name
=
"Show Single Problem"
,
help
=
'When True, only the single problem specified by "Link to Problem Location" is shown. '
'When False, a panel is displayed with all problems available for peer grading.'
,
default
=
USE_FOR_SINGLE_LOCATION
,
default
=
False
,
scope
=
Scope
.
settings
)
link_to_location
=
String
(
display_name
=
"Link to Problem Location"
,
help
=
'The location of the problem being graded. Only used when "Show Single Problem" is True.'
,
default
=
LINK_TO_LOCATION
,
default
=
""
,
scope
=
Scope
.
settings
)
is_
graded
=
Boolean
(
graded
=
Boolean
(
display_name
=
"Graded"
,
help
=
'Defines whether the student gets credit for grading this problem. Only used when "Show Single Problem" is True.'
,
default
=
IS_GRADED
,
default
=
False
,
scope
=
Scope
.
settings
)
due_date
=
Date
(
...
...
@@ -56,12 +51,6 @@ class PeerGradingFields(object):
default
=
None
,
scope
=
Scope
.
settings
)
max_grade
=
Integer
(
help
=
"The maximum grade that a student can receive for this problem."
,
default
=
MAX_SCORE
,
scope
=
Scope
.
settings
,
values
=
{
"min"
:
0
}
)
student_data_for_location
=
Dict
(
help
=
"Student data for a given peer grading problem."
,
scope
=
Scope
.
user_state
...
...
@@ -136,10 +125,6 @@ class PeerGradingModule(PeerGradingFields, XModule):
if
not
self
.
ajax_url
.
endswith
(
"/"
):
self
.
ajax_url
=
self
.
ajax_url
+
"/"
# Integer could return None, so keep this check.
if
not
isinstance
(
self
.
max_grade
,
int
):
raise
TypeError
(
"max_grade needs to be an integer."
)
def
closed
(
self
):
return
self
.
_closed
(
self
.
timeinfo
)
...
...
@@ -232,7 +217,7 @@ class PeerGradingModule(PeerGradingFields, XModule):
'score'
:
score
,
'total'
:
max_score
,
}
if
not
self
.
use_for_single_location
or
not
self
.
is_
graded
:
if
not
self
.
use_for_single_location
or
not
self
.
graded
:
return
score_dict
try
:
...
...
@@ -253,7 +238,7 @@ class PeerGradingModule(PeerGradingFields, XModule):
self
.
student_data_for_location
=
response
score
=
int
(
count_graded
>=
count_required
and
count_graded
>
0
)
*
float
(
weight
)
total
=
self
.
max_grade
*
float
(
weight
)
total
=
float
(
weight
)
score_dict
[
'score'
]
=
score
score_dict
[
'total'
]
=
total
...
...
@@ -266,8 +251,8 @@ class PeerGradingModule(PeerGradingFields, XModule):
randomization, and 5/7 on another
'''
max_grade
=
None
if
self
.
use_for_single_location
and
self
.
is_
graded
:
max_grade
=
self
.
max_grade
if
self
.
use_for_single_location
and
self
.
graded
:
max_grade
=
self
.
weight
return
max_grade
def
get_next_submission
(
self
,
data
):
...
...
@@ -634,9 +619,13 @@ class PeerGradingDescriptor(PeerGradingFields, RawDescriptor):
#Specify whether or not to pass in open ended interface
needs_open_ended_interface
=
True
metadata_translations
=
{
'is_graded'
:
'graded'
,
'attempts'
:
'max_attempts'
,
}
@property
def
non_editable_metadata_fields
(
self
):
non_editable_fields
=
super
(
PeerGradingDescriptor
,
self
)
.
non_editable_metadata_fields
non_editable_fields
.
extend
([
PeerGradingFields
.
due_date
,
PeerGradingFields
.
grace_period_string
,
PeerGradingFields
.
max_grade
])
non_editable_fields
.
extend
([
PeerGradingFields
.
due_date
,
PeerGradingFields
.
grace_period_string
])
return
non_editable_fields
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