Commit 286dcd3c by Andy Armstrong

Address code review feedback

parent 958c15ac
...@@ -58,14 +58,14 @@ ...@@ -58,14 +58,14 @@
{% endfor %} {% endfor %}
<li class="wrapper--input field field--textarea assessment__rubric__question assessment__rubric__question--feedback"> <li class="wrapper--input field field--textarea assessment__rubric__question assessment__rubric__question--feedback">
<label class="question__title" for="{{ rubric_type }}__assessment__rubric__question--feedback__value"> <label class="question__title" for="{{ rubric_type }}__assessment__rubric__question--feedback__value">
<span class="question__title__copy">{{ rubric_feedback_prompt }}</span> <span class="question__title__copy">{% trans rubric_feedback_prompt %}</span>
</label> </label>
<div class="wrapper--input"> <div class="wrapper--input">
<textarea <textarea
id="{{ rubric_type }}__assessment__rubric__question--feedback__value" id="{{ rubric_type }}__assessment__rubric__question--feedback__value"
class="assessment__rubric__question--feedback__value" class="assessment__rubric__question--feedback__value"
placeholder="{{ rubric_feedback_default_text }}" placeholder="{% trans rubric_feedback_default_text %}"
maxlength="500" maxlength="500"
> >
</textarea> </textarea>
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
{% trans "View the file associated with this submission." %} {% trans "View the file associated with this submission." %}
</a> </a>
{% if show_warning %} {% if show_warning %}
<p class="submission_file_warning">{% trans "(Caution: This file was uploaded by another course learner and has not been verified, screened, approved, reviewed or endorsed by edX. If you decide to access it, you do so at your own risk.)" %}</p> <p class="submission_file_warning">{% trans "(Caution: This file was uploaded by another course learner and has not been verified, screened, approved, reviewed, or endorsed by edX. If you decide to access it, you do so at your own risk.)" %}</p>
{% endif %} {% endif %}
{% endif %} {% endif %}
</div> </div>
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
{% load tz %} {% load tz %}
{% block list_item %} {% block list_item %}
<li id="openassessment__response" class="openassessment__steps__step step--response ui-toggle-visibility has--error"> <li id="openassessment__response" class="openassessment__steps__step step--response ui-toggle-visibility has--error">
{% endblock %} {% endblock %}
{% block title %} {% block title %}
...@@ -28,23 +28,14 @@ ...@@ -28,23 +28,14 @@
{% blocktrans with removed_datetime=workflow_cancellation.cancelled_at|utc|date:"N j, Y H:i e" removed_by_username=workflow_cancellation.cancelled_by %} {% blocktrans with removed_datetime=workflow_cancellation.cancelled_at|utc|date:"N j, Y H:i e" removed_by_username=workflow_cancellation.cancelled_by %}
Your submission has been cancelled by {{ removed_by_username }} on {{ removed_datetime }} Your submission has been cancelled by {{ removed_by_username }} on {{ removed_datetime }}
{% endblocktrans %} {% endblocktrans %}
<br> </p>
<p>
<!-- Comments: Reason for Cancellation--> <!-- Comments: Reason for Cancellation-->
{% blocktrans with comments=workflow_cancellation.comments %} {% blocktrans with comments=workflow_cancellation.comments %}
Comments: {{ comments }} Comments: {{ comments }}
{% endblocktrans %} {% endblocktrans %}
</p> </p>
</div> </div>
<div class="step__content">
<article class="submission__answer__display">
<h3 class="submission__answer__display__title">{% trans "Your Response" %}</h3>
<div class="submission__answer__display__content">
{{ student_submission.answer.text|linebreaks }}
</div>
</article>
</div>
</div> </div>
</div> </div>
</div> </div>
......
{% load tz %}
{% load i18n %} {% load i18n %}
{% spaceless %} {% spaceless %}
...@@ -6,7 +5,7 @@ ...@@ -6,7 +5,7 @@
<div class="ui-toggle-visibility__content"> <div class="ui-toggle-visibility__content">
<div class="wrapper--staff-assessment"> <div class="wrapper--staff-assessment">
<div class="step__instruction"> <div class="step__instruction">
<p>{% trans "Allows you to override the current learner's grade using the problem's rubric." %}</p> <p>{% trans "Override this learner's current grade using the problem's rubric." %}</p>
</div> </div>
<div class="step__content"> <div class="step__content">
...@@ -42,6 +41,8 @@ ...@@ -42,6 +41,8 @@
<button type="submit" class="action action--submit is--disabled"> <button type="submit" class="action action--submit is--disabled">
<span class="copy">{% trans "Submit your assessment" %}</span> <span class="copy">{% trans "Submit your assessment" %}</span>
</button> </button>
<div class="staff-override-error"></div>
</li> </li>
</ul> </ul>
</div> </div>
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<div class="ui-staff ui-toggle-visibility is--collapsed"> <div class="ui-staff ui-toggle-visibility is--collapsed">
<h2 class="staff-info__title ui-staff__subtitle ui-toggle-visibility__control"> <h2 class="staff-info__title ui-staff__subtitle ui-toggle-visibility__control">
<i class="icon fa fa-caret-right" aria-hidden="true"></i> <i class="icon fa fa-caret-right" aria-hidden="true"></i>
<span>{% trans "Learner Response" %}</span> <span>{% trans "Learner's Response" %}</span>
</h2> </h2>
<div class="ui-toggle-visibility__content"> <div class="ui-toggle-visibility__content">
{% if workflow_cancellation %} {% if workflow_cancellation %}
...@@ -39,13 +39,13 @@ ...@@ -39,13 +39,13 @@
<a href="{{ submission.file_url }}" class="submission--file"> <a href="{{ submission.file_url }}" class="submission--file">
{% trans "The file associated with this response." %} {% trans "The file associated with this response." %}
</a> </a>
<span>{% trans "Caution: This file was uploaded by another course learner and has not been verified, screened, approved, reviewed or endorsed by edX. If you decide to access it, you do so at your own risk." %}</span> <span>{% trans "Caution: This file was uploaded by another course learner and has not been verified, screened, approved, reviewed, or endorsed by edX. If you decide to access it, you do so at your own risk." %}</span>
{% endif %} {% endif %}
</div> </div>
</div> </div>
</div> </div>
{% if peer_assessments %} {% if peer_assessments != None %}
<div class="staff-info__status ui-staff__content__section wrapper--ui--collapse"> <div class="staff-info__status ui-staff__content__section wrapper--ui--collapse">
<div class="ui-staff ui-toggle-visibility is--collapsed"> <div class="ui-staff ui-toggle-visibility is--collapsed">
<h2 class="staff-info__title ui-staff__subtitle ui-toggle-visibility__control"> <h2 class="staff-info__title ui-staff__subtitle ui-toggle-visibility__control">
...@@ -53,6 +53,7 @@ ...@@ -53,6 +53,7 @@
<span>{% trans "Peer Assessments for This Learner" %}</span> <span>{% trans "Peer Assessments for This Learner" %}</span>
</h2> </h2>
<div class="ui-toggle-visibility__content"> <div class="ui-toggle-visibility__content">
{% if peer_assessments %}
{% for assessment in peer_assessments %} {% for assessment in peer_assessments %}
{% with peer_num=forloop.counter %} {% with peer_num=forloop.counter %}
<h4 class="title--sub"> {% trans "Peer" %} {{ peer_num }}: </h4> <h4 class="title--sub"> {% trans "Peer" %} {{ peer_num }}: </h4>
...@@ -87,12 +88,15 @@ ...@@ -87,12 +88,15 @@
</div> </div>
{% endwith %} {% endwith %}
{% endfor %} {% endfor %}
{% else %}
<p>{% trans "This learner currently has no peer assessments." %}</p>
{% endif %}
</div> </div>
</div> </div>
</div> </div>
{% endif %} {% endif %}
{% if submitted_assessments %} {% if submitted_assessments != None %}
<div class="staff-info__status ui-staff__content__section wrapper--ui--collapse"> <div class="staff-info__status ui-staff__content__section wrapper--ui--collapse">
<div class="ui-staff ui-toggle-visibility is--collapsed"> <div class="ui-staff ui-toggle-visibility is--collapsed">
<h2 class="staff-info__title ui-staff__subtitle ui-toggle-visibility__control"> <h2 class="staff-info__title ui-staff__subtitle ui-toggle-visibility__control">
...@@ -100,6 +104,7 @@ ...@@ -100,6 +104,7 @@
<span>{% trans "Peer Assessments Completed by This Learner" %}</span> <span>{% trans "Peer Assessments Completed by This Learner" %}</span>
</h2> </h2>
<div class="ui-toggle-visibility__content"> <div class="ui-toggle-visibility__content">
{% if submitted_assessments %}
{% for assessment in submitted_assessments %} {% for assessment in submitted_assessments %}
{% with peer_num=forloop.counter %} {% with peer_num=forloop.counter %}
<h4 class="title--sub">{% trans "Assessment" %} {{ peer_num }}:</h4> <h4 class="title--sub">{% trans "Assessment" %} {{ peer_num }}:</h4>
...@@ -136,6 +141,9 @@ ...@@ -136,6 +141,9 @@
</div> </div>
{% endwith %} {% endwith %}
{% endfor %} {% endfor %}
{% else %}
<p>{% trans "This learner has not completed any peer assessments." %}</p>
{% endif %}
</div> </div>
</div> </div>
</div> </div>
...@@ -225,15 +233,17 @@ ...@@ -225,15 +233,17 @@
</h2> </h2>
<div class="ui-toggle-visibility__content"> <div class="ui-toggle-visibility__content">
{% if workflow_status == "done" %} {% if workflow_status == "done" %}
<p>
{% with points_earned_string=score.points_earned|stringformat:"s" points_possible_string=score.points_possible|stringformat:"s" %} {% with points_earned_string=score.points_earned|stringformat:"s" points_possible_string=score.points_possible|stringformat:"s" %}
{% blocktrans with points_earned='<span class="grade__value__earned">'|safe|add:points_earned_string|add:'</span>'|safe points_possible='<span class="grade__value__potential">'|safe|add:points_possible_string|add:'</span>'|safe %} {% blocktrans with points_earned='<span class="grade__value__earned">'|safe|add:points_earned_string|add:'</span>'|safe points_possible='<span class="grade__value__potential">'|safe|add:points_possible_string|add:'</span>'|safe %}
Final grade: {{ points_earned }} out of {{ points_possible }} Final grade: {{ points_earned }} out of {{ points_possible }}
{% endblocktrans %} {% endblocktrans %}
{% endwith %} {% endwith %}
</p>
{% elif workflow_status == "waiting" %} {% elif workflow_status == "waiting" %}
<p>{% trans "The submission is waiting for assessments." %}</p> <p>{% trans "The submission is waiting for assessments." %}</p>
{% elif workflow_status == "cancelled" %} {% elif workflow_status == "cancelled" %}
<p>{% trans "The learner's submission has been removed from peer assessment. The learner receives a grade of zero unless you reset the learner's attempts for the problem to allow them to resubmit a response." %}</p> <p>{% trans "The learner's submission has been removed from peer assessment. The learner receives a grade of zero unless you delete the learner's state for the problem to allow them to resubmit a response." %}</p>
{% elif workflow_status == None %} {% elif workflow_status == None %}
<p>{% trans "The problem has not been started." %}</p> <p>{% trans "The problem has not been started." %}</p>
{% else %} {% else %}
......
...@@ -231,7 +231,8 @@ class StaffAreaMixin(object): ...@@ -231,7 +231,8 @@ class StaffAreaMixin(object):
Args: Args:
student_username (unicode): The username of the student to report. student_username (unicode): The username of the student to report.
expanded_view (str): An optional view to be shown initially expanded.
The default is None meaning that all views are shown collapsed.
""" """
submission_uuid = None submission_uuid = None
submission = None submission = None
...@@ -269,8 +270,8 @@ class StaffAreaMixin(object): ...@@ -269,8 +270,8 @@ class StaffAreaMixin(object):
example_based_assessment = None example_based_assessment = None
self_assessment = None self_assessment = None
peer_assessments = [] peer_assessments = None
submitted_assessments = [] submitted_assessments = None
if "peer-assessment" in assessment_steps: if "peer-assessment" in assessment_steps:
peer_assessments = peer_api.get_assessments(submission_uuid) peer_assessments = peer_api.get_assessments(submission_uuid)
......
...@@ -758,6 +758,68 @@ ...@@ -758,6 +758,68 @@
"output": "oa_staff_cancelled_submission.html" "output": "oa_staff_cancelled_submission.html"
}, },
{ {
"template": "openassessmentblock/staff_area/oa_student_info.html",
"context": {
"rubric_criteria": [
{
"name": "vocabulary",
"prompt": "vocabulary",
"order_num": 0,
"feedback": "optional",
"options": [
{
"order_num": 0,
"points": 0,
"name": "Bad"
},
{
"order_num": 1,
"points": 1,
"name": "Good"
}
]
},
{
"name": "grammar",
"prompt": "grammar",
"order_num": 1,
"options": [
{
"order_num": 0,
"points": 0,
"name": "Bad"
},
{
"order_num": 1,
"points": 1,
"name": "Good"
}
]
},
{
"name": "feedback_only",
"prompt": "Feedback only, no options!",
"order_num": 2,
"feedback": "required",
"options": []
}
],
"submission": {
"image_url": "/test-url",
"answer": {
"text": "testing response text"
}
},
"score": {
"points_earned": 1,
"points_possible": 2
},
"workflow_status": "done",
"expanded_view": "final-grade"
},
"output": "oa_staff_graded_submission.html"
},
{
"template": "openassessmentblock/peer/oa_peer_assessment.html", "template": "openassessmentblock/peer/oa_peer_assessment.html",
"context": { "context": {
"rubric_criteria": [ "rubric_criteria": [
......
...@@ -4,6 +4,18 @@ ...@@ -4,6 +4,18 @@
describe('OpenAssessment.StaffAreaView', function() { describe('OpenAssessment.StaffAreaView', function() {
'use strict'; 'use strict';
var successPromise = $.Deferred(
function(defer) { defer.resolve(); }
).promise();
var failWith = function(owner, result) {
return function() {
return $.Deferred(function(defer) {
defer.rejectWith(owner, [result]);
}).promise();
};
};
// Stub server that returns dummy data for the staff info view // Stub server that returns dummy data for the staff info view
var StubServer = function() { var StubServer = function() {
this.studentTemplate = 'oa_student_info.html'; this.studentTemplate = 'oa_student_info.html';
...@@ -43,10 +55,6 @@ describe('OpenAssessment.StaffAreaView', function() { ...@@ -43,10 +55,6 @@ describe('OpenAssessment.StaffAreaView', function() {
}).promise(); }).promise();
}; };
var successPromise = $.Deferred(
function(defer) { defer.resolve(); }
).promise();
this.cancelSubmission = function() { this.cancelSubmission = function() {
return successPromise; return successPromise;
}; };
...@@ -300,21 +308,42 @@ describe('OpenAssessment.StaffAreaView', function() { ...@@ -300,21 +308,42 @@ describe('OpenAssessment.StaffAreaView', function() {
'Comments: Cancelled!' 'Comments: Cancelled!'
); );
}); });
it('shows an error message when a cancel submission request fails', function() {
// Show the staff area for the test student
var staffArea = createStaffArea(),
serverErrorMessage = 'Mock server error';
chooseStudent(staffArea, 'testStudent');
// Cancel the student's submission but return a server error
staffArea.comment('Cancellation reason.');
server.cancelSubmission = failWith(server, serverErrorMessage);
staffArea.cancelSubmission('Bob');
// Verify that the error message is shown
expect($('.cancel-submission-error', staffArea.element).first().text().trim()).toBe(serverErrorMessage);
});
}); });
describe('Staff Grade Override', function() { describe('Staff Grade Override', function() {
var fillAssessment = function($assessment) { var fillAssessment = function($assessment) {
$('#staff__assessment__rubric__question--2__feedback', $assessment).val('Text response'); $('#staff__assessment__rubric__question--2__feedback', $assessment).val('Text response');
$('.question__answers', $assessment).each(function(element) { $('.question__answers', $assessment).each(function() {
$('input[type="radio"]', this).first().click(); $('input[type="radio"]', this).first().click();
}); });
}; };
var submitAssessment = function(staffArea) {
var $assessment = $('.wrapper--staff-assessment', staffArea.element),
$submitButton = $('.action--submit', $assessment);
$submitButton.click();
};
it('enables the submit button when all required fields are specified', function() { it('enables the submit button when all required fields are specified', function() {
var staffArea = createStaffArea(), var staffArea = createStaffArea(),
$assessment, $submitButton; $assessment, $submitButton;
chooseStudent(staffArea, 'testStudent'); chooseStudent(staffArea, 'testStudent');
$assessment = $('.wrapper--staff-assessment', staffArea.element) $assessment = $('.wrapper--staff-assessment', staffArea.element);
$submitButton = $('.action--submit', $assessment); $submitButton = $('.action--submit', $assessment);
expect($submitButton).toHaveClass('is--disabled'); expect($submitButton).toHaveClass('is--disabled');
fillAssessment($assessment); fillAssessment($assessment);
...@@ -323,24 +352,39 @@ describe('OpenAssessment.StaffAreaView', function() { ...@@ -323,24 +352,39 @@ describe('OpenAssessment.StaffAreaView', function() {
it('can submit a staff grade override', function() { it('can submit a staff grade override', function() {
var staffArea = createStaffArea(), var staffArea = createStaffArea(),
$assessment, $submitButton; $assessment, $gradeSection;
chooseStudent(staffArea, 'testStudent'); chooseStudent(staffArea, 'testStudent');
$assessment = $('.wrapper--staff-assessment', staffArea.element) $assessment = $('.wrapper--staff-assessment', staffArea.element);
$submitButton = $('.action--submit', $assessment);
fillAssessment($assessment); fillAssessment($assessment);
// Submit the assessment // Submit the assessment
server.studentTemplate = 'oa_staff_cancelled_submission.html'; server.studentTemplate = 'oa_staff_graded_submission.html';
$submitButton.click(); submitAssessment(staffArea);
// Verify that the student info reflects the update // Verify that the student info is visible and shows the correct score
expect($($('.staff-info__student__response p', staffArea.element)[0]).text().trim()).toBe( $gradeSection = $('.staff-info__student__grade', staffArea.element);
'Learner submission removed by staff on October 1, 2015 04:53 UTC' expect($('.ui-toggle-visibility', $gradeSection)).not.toHaveClass('is--collapsed');
); expect($('p', $gradeSection).first().text().trim()).toBe(
expect($($('.staff-info__student__response p', staffArea.element)[1]).text().trim()).toBe( 'Final grade: 1 out of 2'
'Comments: Cancelled!'
); );
}); });
it('shows an error message when a grade override request fails', function() {
var staffArea = createStaffArea(),
serverErrorMessage = 'Mock server error',
$assessment;
chooseStudent(staffArea, 'testStudent');
$assessment = $('.wrapper--staff-assessment', staffArea.element);
fillAssessment($assessment);
// Submit the assessment but return a server error message
staffArea.comment('Cancellation reason.');
server.staffAssess = failWith(server, serverErrorMessage);
submitAssessment(staffArea);
// Verify that the error message is shown
expect($('.staff-override-error', staffArea.element).first().text().trim()).toBe(serverErrorMessage);
});
}); });
}); });
......
...@@ -150,6 +150,7 @@ OpenAssessment.PeerView.prototype = { ...@@ -150,6 +150,7 @@ OpenAssessment.PeerView.prototype = {
return !button.hasClass('is--disabled'); return !button.hasClass('is--disabled');
} else { } else {
button.toggleClass('is--disabled', !enabled); button.toggleClass('is--disabled', !enabled);
return enabled;
} }
}, },
......
...@@ -169,6 +169,7 @@ OpenAssessment.ResponseView.prototype = { ...@@ -169,6 +169,7 @@ OpenAssessment.ResponseView.prototype = {
return !sel.hasClass('is--disabled'); return !sel.hasClass('is--disabled');
} else { } else {
sel.toggleClass('is--disabled', !enabled); sel.toggleClass('is--disabled', !enabled);
return enabled;
} }
}, },
......
...@@ -91,6 +91,7 @@ OpenAssessment.SelfView.prototype = { ...@@ -91,6 +91,7 @@ OpenAssessment.SelfView.prototype = {
return !button.hasClass('is--disabled'); return !button.hasClass('is--disabled');
} else { } else {
button.toggleClass('is--disabled', !enabled); button.toggleClass('is--disabled', !enabled);
return enabled;
} }
}, },
......
...@@ -30,16 +30,14 @@ ...@@ -30,16 +30,14 @@
// for us to render the staff area into. If that doesn't exist, // for us to render the staff area into. If that doesn't exist,
// then we're not staff, so we don't need to send the AJAX request. // then we're not staff, so we don't need to send the AJAX request.
if ($('.openassessment__staff-area', view.element).length > 0) { if ($('.openassessment__staff-area', view.element).length > 0) {
this.server.render('staff_area') this.server.render('staff_area').done(function(html) {
.done(function(html) {
// Load the HTML and install event handlers // Load the HTML and install event handlers
$('.openassessment__staff-area', view.element).replaceWith(html); $('.openassessment__staff-area', view.element).replaceWith(html);
view.server.renderLatex($('.openassessment__staff-area', view.element)); view.server.renderLatex($('.openassessment__staff-area', view.element));
view.installHandlers(); view.installHandlers();
}).fail(function() { }).fail(function() {
view.baseView.showLoadError('staff_area'); view.baseView.showLoadError('staff_area');
} });
);
} }
}, },
...@@ -66,8 +64,7 @@ ...@@ -66,8 +64,7 @@
$('.openassessment__student-info', view.element).text(''); $('.openassessment__student-info', view.element).text('');
if (student_username.trim()) { if (student_username.trim()) {
this.server.studentInfo(student_username, options) this.server.studentInfo(student_username, options).done(function(html) {
.done(function(html) {
// Clear any error message // Clear any error message
showFormError(''); showFormError('');
...@@ -108,8 +105,7 @@ ...@@ -108,8 +105,7 @@
); );
} }
deferred.resolve(); deferred.resolve();
}) }).fail(function() {
.fail(function() {
showFormError(gettext('Unexpected server error.')); showFormError(gettext('Unexpected server error.'));
deferred.reject(); deferred.reject();
}); });
...@@ -203,8 +199,7 @@ ...@@ -203,8 +199,7 @@
*/ */
scheduleTraining: function() { scheduleTraining: function() {
var view = this; var view = this;
this.server.scheduleTraining() this.server.scheduleTraining().done(function(msg) {
.done(function(msg) {
$('.schedule_training_message', view.element).text(msg); $('.schedule_training_message', view.element).text(msg);
}).fail(function(errMsg) { }).fail(function(errMsg) {
$('.schedule_training_message', view.element).text(errMsg); $('.schedule_training_message', view.element).text(errMsg);
...@@ -218,8 +213,7 @@ ...@@ -218,8 +213,7 @@
*/ */
rescheduleUnfinishedTasks: function() { rescheduleUnfinishedTasks: function() {
var view = this; var view = this;
this.server.rescheduleUnfinishedTasks() this.server.rescheduleUnfinishedTasks().done(function(msg) {
.done(function(msg) {
$('.reschedule_unfinished_tasks_message', view.element).text(msg); $('.reschedule_unfinished_tasks_message', view.element).text(msg);
}).fail(function(errMsg) { }).fail(function(errMsg) {
$('.reschedule_unfinished_tasks_message', view.element).text(errMsg); $('.reschedule_unfinished_tasks_message', view.element).text(errMsg);
...@@ -234,16 +228,14 @@ ...@@ -234,16 +228,14 @@
this.cancelSubmissionEnabled(false); this.cancelSubmissionEnabled(false);
var view = this; var view = this;
var comments = $('.cancel_submission_comments', this.element).val(); var comments = $('.cancel_submission_comments', this.element).val();
this.server.cancelSubmission(submissionUUID, comments) this.server.cancelSubmission(submissionUUID, comments).done(function() {
.done(function(msg) { // Note: we ignore any message returned from the server and instead
$('.cancel-submission-error').html(''); // re-render the student info with the "Learner's Final Grade"
view.loadStudentInfo({expanded_view: 'final-grade'}) // section expanded. This section will show that the learner's
.done(function() { // submission was cancelled.
$('.openassessment__staff-info__cancel__submission', view.element).html(msg); view.loadStudentInfo({expanded_view: 'final-grade'});
}); }).fail(function(errorMessage) {
}) $('.cancel-submission-error').html(errorMessage);
.fail(function(errMsg) {
$('.cancel-submission-error').html(errMsg);
}); });
}, },
...@@ -315,6 +307,7 @@ ...@@ -315,6 +307,7 @@
return !button.hasClass('is--disabled'); return !button.hasClass('is--disabled');
} else { } else {
button.toggleClass('is--disabled', !enabled); button.toggleClass('is--disabled', !enabled);
return enabled;
} }
}, },
...@@ -332,12 +325,15 @@ ...@@ -332,12 +325,15 @@
this.server.staffAssess( this.server.staffAssess(
rubric.optionsSelected(), rubric.criterionFeedback(), rubric.overallFeedback(), submissionID rubric.optionsSelected(), rubric.criterionFeedback(), rubric.overallFeedback(), submissionID
) ).done(function() {
.done(function() { // Note: we ignore any message returned from the server and instead
// re-render the student info with the "Learner's Final Grade"
// section expanded. This section will show the learner's
// final grade and in the future should include details of
// the staff override itself.
view.loadStudentInfo({expanded_view: 'final-grade'}); view.loadStudentInfo({expanded_view: 'final-grade'});
}) }).fail(function(errorMessage) {
.fail(function(errorMessage) { $('.staff-override-error').html(errorMessage);
baseView.toggleActionError('staff', errorMessage);
view.staffSubmitEnabled(true); view.staffSubmitEnabled(true);
}); });
} }
......
...@@ -231,7 +231,7 @@ class TestCourseStaff(XBlockHandlerTestCase): ...@@ -231,7 +231,7 @@ class TestCourseStaff(XBlockHandlerTestCase):
path, context = xblock.get_student_info_path_and_context("Bob") path, context = xblock.get_student_info_path_and_context("Bob")
self.assertEquals("Bob Answer 1", context['submission']['answer']['parts'][0]['text']) self.assertEquals("Bob Answer 1", context['submission']['answer']['parts'][0]['text'])
self.assertEquals([], context['peer_assessments']) self.assertEquals(None, context['peer_assessments'])
self.assertEquals("openassessmentblock/staff_area/oa_student_info.html", path) self.assertEquals("openassessmentblock/staff_area/oa_student_info.html", path)
@scenario('data/basic_scenario.xml', user_id='Bob') @scenario('data/basic_scenario.xml', user_id='Bob')
......
...@@ -399,7 +399,7 @@ class StaffAreaTest(OpenAssessmentTest): ...@@ -399,7 +399,7 @@ class StaffAreaTest(OpenAssessmentTest):
self.staff_area_page.verify_learner_final_score( self.staff_area_page.verify_learner_final_score(
"The learner's submission has been removed from peer assessment. " "The learner's submission has been removed from peer assessment. "
"The learner receives a grade of zero unless you reset the learner's attempts for the " "The learner receives a grade of zero unless you delete the learner's state for the "
"problem to allow them to resubmit a response." "problem to allow them to resubmit a response."
) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment