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
31c89e6d
Commit
31c89e6d
authored
Feb 05, 2013
by
Diana Huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Consolidate error messages.
parent
c70531ae
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
10 deletions
+22
-10
common/lib/xmodule/xmodule/open_ended_module.py
+3
-5
common/lib/xmodule/xmodule/openendedchild.py
+16
-0
common/lib/xmodule/xmodule/self_assessment_module.py
+3
-5
No files found.
common/lib/xmodule/xmodule/open_ended_module.py
View file @
31c89e6d
...
...
@@ -550,11 +550,9 @@ class OpenEndedModule(openendedchild.OpenEndedChild):
"""
# Once we close the problem, we should not allow students
# to save answers
if
self
.
closed
():
return
{
'success'
:
False
,
'error'
:
'Problem is closed.'
}
closed
,
msg
=
self
.
check_if_closed
()
if
closed
:
return
msg
if
self
.
state
!=
self
.
INITIAL
:
return
self
.
out_of_sync_error
(
get
)
...
...
common/lib/xmodule/xmodule/openendedchild.py
View file @
31c89e6d
...
...
@@ -122,6 +122,22 @@ class OpenEndedChild(object):
return
True
return
False
def
check_if_closed
(
self
):
if
self
.
closed
():
return
True
,
{
'success'
:
False
,
'error'
:
'This problem is now closed.'
}
elif
self
.
attempts
>
self
.
max_attempts
:
return
True
,
{
'success'
:
False
,
'error'
:
'Too many attempts.'
}
else
:
return
False
,
{}
def
latest_answer
(
self
):
"""Empty string if not available"""
if
not
self
.
history
:
...
...
common/lib/xmodule/xmodule/self_assessment_module.py
View file @
31c89e6d
...
...
@@ -190,11 +190,9 @@ class SelfAssessmentModule(openendedchild.OpenEndedChild):
or 'rubric_html' (if success).
"""
# Check to see if this problem is closed
if
self
.
closed
():
return
{
'success'
:
False
,
'error'
:
'This problem is now closed.'
}
closed
,
msg
=
self
.
check_if_closed
()
if
closed
:
return
msg
if
self
.
state
!=
self
.
INITIAL
:
return
self
.
out_of_sync_error
(
get
)
...
...
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