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
1cc5e615
Commit
1cc5e615
authored
Feb 13, 2013
by
Vik Paruchuri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More fixes on error messages
parent
0627b7b9
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
22 deletions
+53
-22
common/lib/xmodule/xmodule/combined_open_ended_module.py
+5
-2
common/lib/xmodule/xmodule/js/src/combinedopenended/display.coffee
+8
-6
common/lib/xmodule/xmodule/open_ended_grading_classes/self_assessment_module.py
+5
-2
common/lib/xmodule/xmodule/peer_grading_module.py
+35
-12
No files found.
common/lib/xmodule/xmodule/combined_open_ended_module.py
View file @
1cc5e615
...
...
@@ -108,11 +108,13 @@ class CombinedOpenEndedModule(XModule):
instance_state
=
{}
self
.
version
=
self
.
metadata
.
get
(
'version'
,
DEFAULT_VERSION
)
version_error_string
=
"Version of combined open ended module {0} is not correct. Going with version {1}"
if
not
isinstance
(
self
.
version
,
basestring
):
try
:
self
.
version
=
str
(
self
.
version
)
except
:
log
.
error
(
"Version {0} is not correct. Going with version {1}"
.
format
(
self
.
version
,
DEFAULT_VERSION
))
#This is a dev_facing_error
log
.
info
(
version_error_string
.
format
(
self
.
version
,
DEFAULT_VERSION
))
self
.
version
=
DEFAULT_VERSION
versions
=
[
i
[
0
]
for
i
in
VERSION_TUPLES
]
...
...
@@ -122,7 +124,8 @@ class CombinedOpenEndedModule(XModule):
try
:
version_index
=
versions
.
index
(
self
.
version
)
except
:
log
.
error
(
"Version {0} is not correct. Going with version {1}"
.
format
(
self
.
version
,
DEFAULT_VERSION
))
#This is a dev_facing_error
log
.
error
(
version_error_string
.
format
(
self
.
version
,
DEFAULT_VERSION
))
self
.
version
=
DEFAULT_VERSION
version_index
=
versions
.
index
(
self
.
version
)
...
...
common/lib/xmodule/xmodule/js/src/combinedopenended/display.coffee
View file @
1cc5e615
...
...
@@ -89,6 +89,8 @@ class @CombinedOpenEnded
@
can_upload_files
=
false
@
open_ended_child
=
@
$
(
'.open-ended-child'
)
@
out_of_sync_message
=
'The problem state got out of sync. Try reloading the page.'
if
@
task_number
>
1
@
prompt_hide
()
else
if
@
task_number
==
1
and
@
child_state
!=
'initial'
...
...
@@ -293,7 +295,7 @@ class @CombinedOpenEnded
$
.
ajaxWithPrefix
(
"
#{
@
ajax_url
}
/save_answer"
,
settings
)
else
@
errors_area
.
html
(
'Problem state got out of sync. Try reloading the page.'
)
@
errors_area
.
html
(
@
out_of_sync_message
)
save_assessment
:
(
event
)
=>
event
.
preventDefault
()
...
...
@@ -315,7 +317,7 @@ class @CombinedOpenEnded
else
@
errors_area
.
html
(
response
.
error
)
else
@
errors_area
.
html
(
'Problem state got out of sync. Try reloading the page.'
)
@
errors_area
.
html
(
@
out_of_sync_message
)
save_hint
:
(
event
)
=>
event
.
preventDefault
()
...
...
@@ -330,7 +332,7 @@ class @CombinedOpenEnded
else
@
errors_area
.
html
(
response
.
error
)
else
@
errors_area
.
html
(
'Problem state got out of sync. Try reloading the page.'
)
@
errors_area
.
html
(
@
out_of_sync_message
)
skip_post_assessment
:
=>
if
@
child_state
==
'post_assessment'
...
...
@@ -342,7 +344,7 @@ class @CombinedOpenEnded
else
@
errors_area
.
html
(
response
.
error
)
else
@
errors_area
.
html
(
'Problem state got out of sync. Try reloading the page.'
)
@
errors_area
.
html
(
@
out_of_sync_message
)
reset
:
(
event
)
=>
event
.
preventDefault
()
...
...
@@ -362,7 +364,7 @@ class @CombinedOpenEnded
else
@
errors_area
.
html
(
response
.
error
)
else
@
errors_area
.
html
(
'Problem state got out of sync. Try reloading the page.'
)
@
errors_area
.
html
(
@
out_of_sync_message
)
next_problem
:
=>
if
@
child_state
==
'done'
...
...
@@ -385,7 +387,7 @@ class @CombinedOpenEnded
else
@
errors_area
.
html
(
response
.
error
)
else
@
errors_area
.
html
(
'Problem state got out of sync. Try reloading the page.'
)
@
errors_area
.
html
(
@
out_of_sync_message
)
gentle_alert
:
(
msg
)
=>
if
@
el
.
find
(
'.open-ended-alert'
).
length
...
...
common/lib/xmodule/xmodule/open_ended_grading_classes/self_assessment_module.py
View file @
1cc5e615
...
...
@@ -90,7 +90,10 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild):
}
if
dispatch
not
in
handlers
:
return
'Error'
#This is a dev_facing_error
log
.
error
(
"Cannot find {0} in handlers in handle_ajax function for open_ended_module.py"
.
format
(
dispatch
))
#This is a dev_facing_error
return
json
.
dumps
({
'error'
:
'Error handling action. Please try again.'
,
'success'
:
False
})
before
=
self
.
get_progress
()
d
=
handlers
[
dispatch
](
get
,
system
)
...
...
@@ -223,7 +226,7 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild):
score_list
[
i
]
=
int
(
score_list
[
i
])
except
ValueError
:
#This is a dev_facing_error
log
.
error
(
"Non-integer score value passed to save_assessment ,
or no score list present."
)
log
.
error
(
"Non-integer score value passed to save_assessment ,or no score list present."
)
#This is a student_facing_error
return
{
'success'
:
False
,
'error'
:
"Error saving your score. Please notify course staff."
}
...
...
common/lib/xmodule/xmodule/peer_grading_module.py
View file @
1cc5e615
...
...
@@ -21,6 +21,8 @@ TRUE_DICT = [True, "True", "true", "TRUE"]
MAX_SCORE
=
1
IS_GRADED
=
True
EXTERNAL_GRADER_NO_CONTACT_ERROR
=
"Failed to contact external graders. Please notify course staff."
class
PeerGradingModule
(
XModule
):
_VERSION
=
1
...
...
@@ -112,7 +114,10 @@ class PeerGradingModule(XModule):
}
if
dispatch
not
in
handlers
:
return
'Error'
#This is a dev_facing_error
log
.
error
(
"Cannot find {0} in handlers in handle_ajax function for open_ended_module.py"
.
format
(
dispatch
))
#This is a dev_facing_error
return
json
.
dumps
({
'error'
:
'Error handling action. Please try again.'
,
'success'
:
False
})
d
=
handlers
[
dispatch
](
get
)
...
...
@@ -130,6 +135,7 @@ class PeerGradingModule(XModule):
count_required
=
response
[
'count_required'
]
success
=
True
except
GradingServiceError
:
#This is a dev_facing_error
log
.
exception
(
"Error getting location data from controller for location {0}, student {1}"
.
format
(
location
,
student_id
))
...
...
@@ -205,10 +211,12 @@ class PeerGradingModule(XModule):
response
=
self
.
peer_gs
.
get_next_submission
(
location
,
grader_id
)
return
response
except
GradingServiceError
:
#This is a dev_facing_error
log
.
exception
(
"Error getting next submission. server url: {0} location: {1}, grader_id: {2}"
.
format
(
self
.
peer_gs
.
url
,
location
,
grader_id
))
#This is a student_facing_error
return
{
'success'
:
False
,
'error'
:
'Could not connect to grading service'
}
'error'
:
EXTERNAL_GRADER_NO_CONTACT_ERROR
}
def
save_grade
(
self
,
get
):
"""
...
...
@@ -245,14 +253,16 @@ class PeerGradingModule(XModule):
score
,
feedback
,
submission_key
,
rubric_scores
,
submission_flagged
)
return
response
except
GradingServiceError
:
log
.
exception
(
"""Error saving grade. server url: {0}, location: {1}, submission_id:{2},
#This is a dev_facing_error
log
.
exception
(
"""Error saving grade to open ended grading service. server url: {0}, location: {1}, submission_id:{2},
submission_key: {3}, score: {4}"""
.
format
(
self
.
peer_gs
.
url
,
location
,
submission_id
,
submission_key
,
score
)
)
#This is a student_facing_error
return
{
'success'
:
False
,
'error'
:
'Could not connect to grading service'
'error'
:
EXTERNAL_GRADER_NO_CONTACT_ERROR
}
def
is_student_calibrated
(
self
,
get
):
...
...
@@ -285,11 +295,13 @@ class PeerGradingModule(XModule):
response
=
self
.
peer_gs
.
is_student_calibrated
(
location
,
grader_id
)
return
response
except
GradingServiceError
:
log
.
exception
(
"Error from grading service. server url: {0}, grader_id: {0}, location: {1}"
#This is a dev_facing_error
log
.
exception
(
"Error from open ended grading service. server url: {0}, grader_id: {0}, location: {1}"
.
format
(
self
.
peer_gs
.
url
,
grader_id
,
location
))
#This is a student_facing_error
return
{
'success'
:
False
,
'error'
:
'Could not connect to grading service'
'error'
:
EXTERNAL_GRADER_NO_CONTACT_ERROR
}
def
show_calibration_essay
(
self
,
get
):
...
...
@@ -328,16 +340,20 @@ class PeerGradingModule(XModule):
response
=
self
.
peer_gs
.
show_calibration_essay
(
location
,
grader_id
)
return
response
except
GradingServiceError
:
log
.
exception
(
"Error from grading service. server url: {0}, location: {0}"
#This is a dev_facing_error
log
.
exception
(
"Error from open ended grading service. server url: {0}, location: {0}"
.
format
(
self
.
peer_gs
.
url
,
location
))
#This is a student_facing_error
return
{
'success'
:
False
,
'error'
:
'Could not connect to grading service'
}
'error'
:
EXTERNAL_GRADER_NO_CONTACT_ERROR
}
# if we can't parse the rubric into HTML,
except
etree
.
XMLSyntaxError
:
#This is a dev_facing_error
log
.
exception
(
"Cannot parse rubric string. Raw string: {0}"
.
format
(
rubric
))
#This is a student_facing_error
return
{
'success'
:
False
,
'error'
:
'Error displaying submission'
}
'error'
:
'Error displaying submission
. Please notify course staff.
'
}
def
save_calibration_essay
(
self
,
get
):
...
...
@@ -376,8 +392,10 @@ class PeerGradingModule(XModule):
submission_key
,
score
,
feedback
,
rubric_scores
)
return
response
except
GradingServiceError
:
#This is a dev_facing_error
log
.
exception
(
"Error saving calibration grade, location: {0}, submission_id: {1}, submission_key: {2}, grader_id: {3}"
.
format
(
location
,
submission_id
,
submission_key
,
grader_id
))
return
self
.
_err_response
(
'Could not connect to grading service'
)
#This is a student_facing_error
return
self
.
_err_response
(
''
)
def
peer_grading
(
self
,
get
=
None
):
'''
...
...
@@ -398,11 +416,13 @@ class PeerGradingModule(XModule):
problem_list
=
problem_list_dict
[
'problem_list'
]
except
GradingServiceError
:
error_text
=
"Error occured while contacting the grading service"
#This is a student_facing_error
error_text
=
EXTERNAL_GRADER_NO_CONTACT_ERROR
success
=
False
# catch error if if the json loads fails
except
ValueError
:
error_text
=
"Could not get problem list"
#This is a student_facing_error
error_text
=
"Could not get list of problems to peer grade. Please notify course staff."
success
=
False
ajax_url
=
self
.
ajax_url
...
...
@@ -426,6 +446,8 @@ class PeerGradingModule(XModule):
if
get
==
None
or
get
.
get
(
'location'
)
==
None
:
if
not
self
.
use_for_single_location
:
#This is an error case, because it must be set to use a single location to be called without get parameters
#This is a dev_facing_error
log
.
error
(
"Peer grading problem in peer_grading_module called with no get parameters, but use_for_single_location is False."
)
return
{
'html'
:
""
,
'success'
:
False
}
problem_location
=
self
.
link_to_location
...
...
@@ -490,6 +512,7 @@ class PeerGradingDescriptor(XmlDescriptor, EditingDescriptor):
expected_children
=
[]
for
child
in
expected_children
:
if
len
(
xml_object
.
xpath
(
child
))
==
0
:
#This is a staff_facing_error
raise
ValueError
(
"Peer grading definition must include at least one '{0}' tag"
.
format
(
child
))
def
parse_task
(
k
):
...
...
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