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
2f6b7d1e
Commit
2f6b7d1e
authored
Apr 16, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Better max score handling
parent
338a5776
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
12 deletions
+36
-12
common/lib/xmodule/xmodule/open_ended_grading_classes/combined_open_ended_modulev1.py
+30
-12
common/lib/xmodule/xmodule/open_ended_grading_classes/openendedchild.py
+6
-0
No files found.
common/lib/xmodule/xmodule/open_ended_grading_classes/combined_open_ended_modulev1.py
View file @
2f6b7d1e
...
@@ -403,6 +403,7 @@ class CombinedOpenEndedV1Module():
...
@@ -403,6 +403,7 @@ class CombinedOpenEndedV1Module():
self
.
static_data
,
instance_state
=
task_state
)
self
.
static_data
,
instance_state
=
task_state
)
last_response
=
task
.
latest_answer
()
last_response
=
task
.
latest_answer
()
last_score
=
task
.
latest_score
()
last_score
=
task
.
latest_score
()
all_scores
=
task
.
all_scores
()
last_post_assessment
=
task
.
latest_post_assessment
(
self
.
system
)
last_post_assessment
=
task
.
latest_post_assessment
(
self
.
system
)
last_post_feedback
=
""
last_post_feedback
=
""
feedback_dicts
=
[{}]
feedback_dicts
=
[{}]
...
@@ -460,6 +461,7 @@ class CombinedOpenEndedV1Module():
...
@@ -460,6 +461,7 @@ class CombinedOpenEndedV1Module():
last_response_dict
=
{
last_response_dict
=
{
'response'
:
last_response
,
'response'
:
last_response
,
'score'
:
last_score
,
'score'
:
last_score
,
'all_scores'
:
all_scores
,
'post_assessment'
:
last_post_assessment
,
'post_assessment'
:
last_post_assessment
,
'type'
:
task_type
,
'type'
:
task_type
,
'max_score'
:
max_score
,
'max_score'
:
max_score
,
...
@@ -738,21 +740,37 @@ class CombinedOpenEndedV1Module():
...
@@ -738,21 +740,37 @@ class CombinedOpenEndedV1Module():
"""
"""
max_score
=
None
max_score
=
None
score
=
None
score
=
None
if
self
.
check_if_done_and_scored
()
:
if
self
.
is_scored
and
self
.
weight
is
not
None
:
#Finds the maximum score of all student attempts and keeps it.
#Finds the maximum score of all student attempts and keeps it.
scores
=
[]
score_mat
=
[]
for
i
in
xrange
(
0
,
self
.
current_task_number
):
for
i
in
xrange
(
0
,
len
(
self
.
task_states
)):
#For each task, extract all student scores on that task (each attempt for each task)
last_response
=
self
.
get_last_response
(
i
)
last_response
=
self
.
get_last_response
(
i
)
try
:
max_score
=
last_response
.
get
(
'max_score'
,
None
)
#This could fail if weight is not defined (is None), or if the last response does not have the needed data.
score
=
last_response
.
get
(
'all_scores'
,
None
)
#Neither is a critical issue, and that particular task score can be skipped for computation.
if
score
is
not
None
:
max_score
=
last_response
[
'max_score'
]
*
float
(
self
.
weight
)
#Convert none scores and weight scores properly
score
=
last_response
[
'score'
]
*
float
(
self
.
weight
)
for
z
in
xrange
(
0
,
len
(
score
)):
scores
.
append
(
score
)
if
score
[
z
]
is
None
:
except
:
score
[
z
]
=
0
pass
score
[
z
]
*=
float
(
self
.
weight
)
if
len
(
scores
)
>
0
:
score_mat
.
append
(
score
)
if
len
(
score_mat
)
>
0
:
#Currently, assume that the final step is the correct one, and that those are the final scores.
#This will change in the future, which is why the machinery above exists to extract all scores on all steps
#TODO: better final score handling.
scores
=
score_mat
[
-
1
]
score
=
max
(
scores
)
score
=
max
(
scores
)
else
:
score
=
0
if
max_score
is
not
None
:
#Weight the max score if it is not None
max_score
*=
float
(
self
.
weight
)
else
:
#Without a max_score, we cannot have a score!
score
=
None
score_dict
=
{
score_dict
=
{
'score'
:
score
,
'score'
:
score
,
...
...
common/lib/xmodule/xmodule/open_ended_grading_classes/openendedchild.py
View file @
2f6b7d1e
...
@@ -162,6 +162,12 @@ class OpenEndedChild(object):
...
@@ -162,6 +162,12 @@ class OpenEndedChild(object):
return
None
return
None
return
self
.
child_history
[
-
1
]
.
get
(
'score'
)
return
self
.
child_history
[
-
1
]
.
get
(
'score'
)
def
all_scores
(
self
):
"""None if not available"""
if
not
self
.
child_history
:
return
None
return
[
self
.
child_history
[
i
]
.
get
(
'score'
)
for
i
in
xrange
(
0
,
len
(
self
.
child_history
))]
def
latest_post_assessment
(
self
,
system
):
def
latest_post_assessment
(
self
,
system
):
"""Empty string if not available"""
"""Empty string if not available"""
if
not
self
.
child_history
:
if
not
self
.
child_history
:
...
...
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