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
fd206a41
Commit
fd206a41
authored
Jun 18, 2013
by
Brian Wilson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure InstructorTask is committed.
parent
5389bba4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
13 deletions
+14
-13
common/lib/xmodule/xmodule/tests/test_capa_module.py
+2
-2
lms/djangoapps/instructor_task/models.py
+6
-5
lms/djangoapps/instructor_task/tests/test_api.py
+2
-2
lms/templates/courseware/instructor_dashboard.html
+4
-4
No files found.
common/lib/xmodule/xmodule/tests/test_capa_module.py
View file @
fd206a41
...
...
@@ -658,11 +658,11 @@ class CapaModuleTest(unittest.TestCase):
# Simulate answering a problem that raises the exception
with
patch
(
'capa.capa_problem.LoncapaProblem.rescore_existing_answers'
)
as
mock_rescore
:
mock_rescore
.
side_effect
=
exception_class
(
u'test error
u
\
03
a9'
)
mock_rescore
.
side_effect
=
exception_class
(
u'test error
\u
03a9
'
)
result
=
module
.
rescore_problem
()
# Expect an AJAX alert message in 'success'
expected_msg
=
u'Error: test error
u
\
03
a9'
expected_msg
=
u'Error: test error
\u
03a9
'
self
.
assertEqual
(
result
[
'success'
],
expected_msg
)
# Expect that the number of attempts is NOT incremented
...
...
lms/djangoapps/instructor_task/models.py
View file @
fd206a41
...
...
@@ -91,7 +91,7 @@ class InstructorTask(models.Model):
task_input
=
json_task_input
,
task_state
=
QUEUING
,
requester
=
requester
)
instructor_task
.
save
()
instructor_task
.
save
_now
()
return
instructor_task
...
...
@@ -125,6 +125,7 @@ class InstructorTask(models.Model):
Truncation is indicated by adding "..." to the end of the value.
"""
tag
=
'...'
task_progress
=
{
'exception'
:
type
(
exception
)
.
__name__
,
'message'
:
str
(
exception
.
message
)}
if
traceback_string
is
not
None
:
# truncate any traceback that goes into the InstructorTask model:
...
...
@@ -135,17 +136,17 @@ class InstructorTask(models.Model):
too_long
=
len
(
json_output
)
-
1023
if
too_long
>
0
:
if
traceback_string
is
not
None
:
if
too_long
>=
len
(
traceback_string
)
-
len
(
'...'
):
if
too_long
>=
len
(
traceback_string
)
-
len
(
tag
):
# remove the traceback entry entirely (so no key or value)
del
task_progress
[
'traceback'
]
too_long
-=
(
len
(
traceback_string
)
+
len
(
'traceback'
))
else
:
# truncate the traceback:
task_progress
[
'traceback'
]
=
traceback_string
[:
-
(
too_long
+
3
)]
+
"..."
too_long
=
-
1
task_progress
[
'traceback'
]
=
traceback_string
[:
-
(
too_long
+
len
(
tag
))]
+
tag
too_long
=
0
if
too_long
>
0
:
# we need to shorten the message:
task_progress
[
'message'
]
=
task_progress
[
'message'
][:
-
(
too_long
+
3
)]
+
"..."
task_progress
[
'message'
]
=
task_progress
[
'message'
][:
-
(
too_long
+
len
(
tag
))]
+
tag
json_output
=
json
.
dumps
(
task_progress
)
return
json_output
...
...
lms/djangoapps/instructor_task/tests/test_api.py
View file @
fd206a41
...
...
@@ -109,10 +109,10 @@ class InstructorTaskSubmitTest(InstructorTaskModuleTestCase):
location
=
InstructorTaskModuleTestCase
.
problem_location
(
problem_url_name
)
if
student
is
not
None
:
instructor_task
=
task_function
(
self
.
create_task_request
(
self
.
instructor
),
self
.
course
.
id
,
location
,
student
)
self
.
course
.
id
,
location
,
student
)
else
:
instructor_task
=
task_function
(
self
.
create_task_request
(
self
.
instructor
),
self
.
course
.
id
,
location
)
self
.
course
.
id
,
location
)
# test resubmitting, by updating the existing record:
instructor_task
=
InstructorTask
.
objects
.
get
(
id
=
instructor_task
.
id
)
...
...
lms/templates/courseware/instructor_dashboard.html
View file @
fd206a41
...
...
@@ -205,8 +205,8 @@ function goto( mode)
</p>
<p>
You may use just the "urlname" if a problem, or "modulename/urlname" if not.
(For example, if the location is
<tt>
i4x://university/course/problem/problemname
</tt>
,
then just provide the
<tt>
problemname
</tt>
.
(For example, if the location is
<tt>
i4x://university/course/problem/problemname
</tt>
,
then just provide the
<tt>
problemname
</tt>
.
If the location is
<tt>
i4x://university/course/notaproblem/someothername
</tt>
, then
provide
<tt>
notaproblem/someothername
</tt>
.)
</p>
...
...
@@ -241,8 +241,8 @@ function goto( mode)
</p>
<p>
You may use just the "urlname" if a problem, or "modulename/urlname" if not.
(For example, if the location is
<tt>
i4x://university/course/problem/problemname
</tt>
,
then just provide the
<tt>
problemname
</tt>
.
(For example, if the location is
<tt>
i4x://university/course/problem/problemname
</tt>
,
then just provide the
<tt>
problemname
</tt>
.
If the location is
<tt>
i4x://university/course/notaproblem/someothername
</tt>
, then
provide
<tt>
notaproblem/someothername
</tt>
.)
</p>
...
...
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