Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-ora2
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-ora2
Commits
4023d756
Commit
4023d756
authored
Mar 26, 2014
by
Joe Blaylock
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tim-346: Addressing PR feedback
parent
0b5d6bda
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
32 additions
and
29 deletions
+32
-29
apps/openassessment/assessment/test/test_serializers.py
+0
-1
apps/openassessment/templates/openassessmentblock/self/oa_self_assessment.html
+1
-0
apps/openassessment/xblock/static/js/openassessment.min.js
+0
-0
apps/openassessment/xblock/static/js/spec/oa_server.js
+25
-20
apps/openassessment/xblock/static/js/src/oa_server.js
+5
-7
apps/submissions/tests/test_api.py
+1
-1
No files found.
apps/openassessment/assessment/test/test_serializers.py
View file @
4023d756
...
@@ -3,7 +3,6 @@ import os.path
...
@@ -3,7 +3,6 @@ import os.path
from
ddt
import
ddt
,
file_data
from
ddt
import
ddt
,
file_data
from
django.test
import
TestCase
from
django.test
import
TestCase
from
rest_framework.serializers
import
ValidationError
from
openassessment.assessment.models
import
Criterion
,
CriterionOption
,
Rubric
,
AssessmentFeedback
from
openassessment.assessment.models
import
Criterion
,
CriterionOption
,
Rubric
,
AssessmentFeedback
from
openassessment.assessment.serializers
import
(
from
openassessment.assessment.serializers
import
(
...
...
apps/openassessment/templates/openassessmentblock/self/oa_self_assessment.html
View file @
4023d756
...
@@ -89,6 +89,7 @@
...
@@ -89,6 +89,7 @@
<div
class=
"step__actions"
>
<div
class=
"step__actions"
>
<div
class=
"message message--inline message--error message--error-server"
>
<div
class=
"message message--inline message--error message--error-server"
>
<h3
class=
"message__title"
>
We could not submit your assessment
</h3>
<h3
class=
"message__title"
>
We could not submit your assessment
</h3>
<div
class=
"message__content"
></div>
</div>
</div>
<ul
class=
"list list--actions"
>
<ul
class=
"list list--actions"
>
...
...
apps/openassessment/xblock/static/js/openassessment.min.js
View file @
4023d756
This diff is collapsed.
Click to expand it.
apps/openassessment/xblock/static/js/spec/oa_server.js
View file @
4023d756
...
@@ -30,6 +30,19 @@ describe("OpenAssessment.Server", function() {
...
@@ -30,6 +30,19 @@ describe("OpenAssessment.Server", function() {
);
);
};
};
var
getHugeTestString
=
function
()
{
var
testStringSize
=
server
.
maxInputSize
+
1
;
var
testString
=
''
;
for
(
i
=
0
;
i
<
(
testStringSize
);
i
++
)
{
testString
+=
'x'
;
}
return
testString
;
}
var
getHugeStringError
=
function
()
{
// return a string that can be used with .toContain()
// "Response text is too large. Please reduce the size of your response and try to submit again.";
return
"text is too large"
}
beforeEach
(
function
()
{
beforeEach
(
function
()
{
// Create the server
// Create the server
// Since the runtime is a stub implementation that ignores the element passed to it,
// Since the runtime is a stub implementation that ignores the element passed to it,
...
@@ -194,17 +207,15 @@ describe("OpenAssessment.Server", function() {
...
@@ -194,17 +207,15 @@ describe("OpenAssessment.Server", function() {
it
(
"confirms that very long submissions fail with an error without ajax"
,
function
()
{
it
(
"confirms that very long submissions fail with an error without ajax"
,
function
()
{
var
receivedErrorCode
=
""
;
var
receivedErrorCode
=
""
;
var
receivedErrorMsg
=
""
;
var
receivedErrorMsg
=
""
;
var
test_string
=
''
;
var
testString
=
getHugeTestString
();
var
test_string_size
=
server
.
get_max_input_size
()
+
1
;
server
.
submit
(
testString
).
fail
(
for
(
i
=
0
;
i
<
(
test_string_size
);
i
++
)
{
test_string
+=
'x'
;
}
server
.
submit
(
test_string
).
fail
(
function
(
errorCode
,
errorMsg
)
{
function
(
errorCode
,
errorMsg
)
{
receivedErrorCode
=
errorCode
;
receivedErrorCode
=
errorCode
;
receivedErrorMsg
=
errorMsg
;
receivedErrorMsg
=
errorMsg
;
}
}
);
);
expect
(
receivedErrorCode
).
toEqual
(
"submit"
);
expect
(
receivedErrorCode
).
toEqual
(
"submit"
);
expect
(
receivedErrorMsg
).
to
Equal
(
"Response text is too large. Please reduce the size of your response and try to submit again."
);
expect
(
receivedErrorMsg
).
to
Contain
(
getHugeStringError
()
);
});
});
it
(
"informs the caller of an server error when sending a submission"
,
function
()
{
it
(
"informs the caller of an server error when sending a submission"
,
function
()
{
...
@@ -225,13 +236,11 @@ describe("OpenAssessment.Server", function() {
...
@@ -225,13 +236,11 @@ describe("OpenAssessment.Server", function() {
it
(
"confirms that very long saves fail with an error without ajax"
,
function
()
{
it
(
"confirms that very long saves fail with an error without ajax"
,
function
()
{
var
receivedErrorMsg
=
""
;
var
receivedErrorMsg
=
""
;
var
test_string
=
''
;
var
testString
=
getHugeTestString
();
var
test_string_size
=
server
.
get_max_input_size
()
+
1
;
server
.
save
(
testString
).
fail
(
for
(
i
=
0
;
i
<
(
test_string_size
);
i
++
)
{
test_string
+=
'x'
;
}
server
.
save
(
test_string
).
fail
(
function
(
errorMsg
)
{
receivedErrorMsg
=
errorMsg
;
}
function
(
errorMsg
)
{
receivedErrorMsg
=
errorMsg
;
}
);
);
expect
(
receivedErrorMsg
).
to
Equal
(
"Response text is too large. Please reduce the size of your response and try to submit again."
);
expect
(
receivedErrorMsg
).
to
Contain
(
getHugeStringError
()
);
});
});
it
(
"informs the caller of an AJAX error when sending a submission"
,
function
()
{
it
(
"informs the caller of an AJAX error when sending a submission"
,
function
()
{
...
@@ -295,15 +304,13 @@ describe("OpenAssessment.Server", function() {
...
@@ -295,15 +304,13 @@ describe("OpenAssessment.Server", function() {
it
(
"confirms that very long peer assessments fail with an error without ajax"
,
function
()
{
it
(
"confirms that very long peer assessments fail with an error without ajax"
,
function
()
{
var
options
=
{
clarity
:
"Very clear"
,
precision
:
"Somewhat precise"
};
var
options
=
{
clarity
:
"Very clear"
,
precision
:
"Somewhat precise"
};
var
receivedErrorMsg
=
""
;
var
receivedErrorMsg
=
""
;
var
test_string
=
''
;
var
testString
=
getHugeTestString
();
var
test_string_size
=
server
.
get_max_input_size
()
+
1
;
server
.
peerAssess
(
"abc1234"
,
options
,
testString
).
fail
(
for
(
i
=
0
;
i
<
(
test_string_size
);
i
++
)
{
test_string
+=
'x'
;
}
server
.
peerAssess
(
"abc1234"
,
options
,
test_string
).
fail
(
function
(
errorMsg
)
{
function
(
errorMsg
)
{
receivedErrorMsg
=
errorMsg
;
receivedErrorMsg
=
errorMsg
;
}
}
);
);
expect
(
receivedErrorMsg
).
to
Equal
(
"Response text is too large. Please reduce the size of your response and try to submit again."
);
expect
(
receivedErrorMsg
).
to
Contain
(
getHugeStringError
()
);
});
});
it
(
"informs the caller of a server error when sending a peer assessment"
,
function
()
{
it
(
"informs the caller of a server error when sending a peer assessment"
,
function
()
{
...
@@ -356,15 +363,13 @@ describe("OpenAssessment.Server", function() {
...
@@ -356,15 +363,13 @@ describe("OpenAssessment.Server", function() {
it
(
"confirms that very long assessment feedback fails with an error without ajax"
,
function
()
{
it
(
"confirms that very long assessment feedback fails with an error without ajax"
,
function
()
{
var
options
=
[
"Option 1"
,
"Option 2"
];
var
options
=
[
"Option 1"
,
"Option 2"
];
var
receivedErrorMsg
=
""
;
var
receivedErrorMsg
=
""
;
var
test_string
=
''
;
var
testString
=
getHugeTestString
();
var
test_string_size
=
server
.
get_max_input_size
()
+
1
;
server
.
submitFeedbackOnAssessment
(
testString
,
options
).
fail
(
for
(
i
=
0
;
i
<
(
test_string_size
);
i
++
)
{
test_string
+=
'x'
;
}
server
.
submitFeedbackOnAssessment
(
test_string
,
options
).
fail
(
function
(
errorMsg
)
{
function
(
errorMsg
)
{
receivedErrorMsg
=
errorMsg
;
receivedErrorMsg
=
errorMsg
;
}
}
);
);
expect
(
receivedErrorMsg
).
to
Equal
(
"Response text is too large. Please reduce the size of your response and try to submit again."
);
expect
(
receivedErrorMsg
).
to
Contain
(
getHugeStringError
()
);
});
});
it
(
"informs the caller of an AJAX error when sending feedback on submission"
,
function
()
{
it
(
"informs the caller of an AJAX error when sending feedback on submission"
,
function
()
{
...
...
apps/openassessment/xblock/static/js/src/oa_server.js
View file @
4023d756
...
@@ -40,9 +40,7 @@ OpenAssessment.Server.prototype = {
...
@@ -40,9 +40,7 @@ OpenAssessment.Server.prototype = {
/*
/*
* Get maximum size of input
* Get maximum size of input
*/
*/
get_max_input_size
:
function
()
{
maxInputSize
:
1024
*
64
,
/* 64KB should be enough for anybody, right? ;^P */
return
1024
*
64
;
/* 64KB should be enough for anybody, right? ;^P */
},
/**
/**
Render the XBlock.
Render the XBlock.
...
@@ -119,7 +117,7 @@ OpenAssessment.Server.prototype = {
...
@@ -119,7 +117,7 @@ OpenAssessment.Server.prototype = {
**/
**/
submit
:
function
(
submission
)
{
submit
:
function
(
submission
)
{
var
url
=
this
.
url
(
'submit'
);
var
url
=
this
.
url
(
'submit'
);
if
(
submission
.
length
>
this
.
get_max_input_size
()
)
{
if
(
submission
.
length
>
this
.
maxInputSize
)
{
return
$
.
Deferred
(
function
(
defer
)
{
return
$
.
Deferred
(
function
(
defer
)
{
defer
.
rejectWith
(
this
,
[
"submit"
,
"Response text is too large. Please reduce the size of your response and try to submit again."
]);
defer
.
rejectWith
(
this
,
[
"submit"
,
"Response text is too large. Please reduce the size of your response and try to submit again."
]);
}).
promise
();
}).
promise
();
...
@@ -159,7 +157,7 @@ OpenAssessment.Server.prototype = {
...
@@ -159,7 +157,7 @@ OpenAssessment.Server.prototype = {
**/
**/
save
:
function
(
submission
)
{
save
:
function
(
submission
)
{
var
url
=
this
.
url
(
'save_submission'
);
var
url
=
this
.
url
(
'save_submission'
);
if
(
submission
.
length
>
this
.
get_max_input_size
()
)
{
if
(
submission
.
length
>
this
.
maxInputSize
)
{
return
$
.
Deferred
(
function
(
defer
)
{
return
$
.
Deferred
(
function
(
defer
)
{
defer
.
rejectWith
(
this
,
[
"Response text is too large. Please reduce the size of your response and try to submit again."
]);
defer
.
rejectWith
(
this
,
[
"Response text is too large. Please reduce the size of your response and try to submit again."
]);
}).
promise
();
}).
promise
();
...
@@ -199,7 +197,7 @@ OpenAssessment.Server.prototype = {
...
@@ -199,7 +197,7 @@ OpenAssessment.Server.prototype = {
*/
*/
submitFeedbackOnAssessment
:
function
(
text
,
options
)
{
submitFeedbackOnAssessment
:
function
(
text
,
options
)
{
var
url
=
this
.
url
(
'submit_feedback'
);
var
url
=
this
.
url
(
'submit_feedback'
);
if
(
text
.
length
>
this
.
get_max_input_size
()
)
{
if
(
text
.
length
>
this
.
maxInputSize
)
{
return
$
.
Deferred
(
function
(
defer
)
{
return
$
.
Deferred
(
function
(
defer
)
{
defer
.
rejectWith
(
this
,
[
"Response text is too large. Please reduce the size of your response and try to submit again."
]);
defer
.
rejectWith
(
this
,
[
"Response text is too large. Please reduce the size of your response and try to submit again."
]);
}).
promise
();
}).
promise
();
...
@@ -243,7 +241,7 @@ OpenAssessment.Server.prototype = {
...
@@ -243,7 +241,7 @@ OpenAssessment.Server.prototype = {
**/
**/
peerAssess
:
function
(
submissionId
,
optionsSelected
,
feedback
)
{
peerAssess
:
function
(
submissionId
,
optionsSelected
,
feedback
)
{
var
url
=
this
.
url
(
'peer_assess'
);
var
url
=
this
.
url
(
'peer_assess'
);
if
(
feedback
.
length
>
this
.
get_max_input_size
()
)
{
if
(
feedback
.
length
>
this
.
maxInputSize
)
{
return
$
.
Deferred
(
function
(
defer
)
{
return
$
.
Deferred
(
function
(
defer
)
{
defer
.
rejectWith
(
this
,
[
"Response text is too large. Please reduce the size of your response and try to submit again."
]);
defer
.
rejectWith
(
this
,
[
"Response text is too large. Please reduce the size of your response and try to submit again."
]);
}).
promise
();
}).
promise
();
...
...
apps/submissions/tests/test_api.py
View file @
4023d756
...
@@ -28,7 +28,7 @@ SECOND_STUDENT_ITEM = dict(
...
@@ -28,7 +28,7 @@ SECOND_STUDENT_ITEM = dict(
ANSWER_ONE
=
u"this is my answer!"
ANSWER_ONE
=
u"this is my answer!"
ANSWER_TWO
=
u"this is my other answer!"
ANSWER_TWO
=
u"this is my other answer!"
ANSWER_THREE
=
u''
+
'c'
*
(
Submission
.
MAXSIZE
+
1
)
ANSWER_THREE
=
u''
+
'c'
*
(
Submission
.
MAXSIZE
+
1
)
@ddt
@ddt
...
...
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