Commit 286dcd3c by Andy Armstrong

Address code review feedback

parent 958c15ac
......@@ -58,14 +58,14 @@
{% endfor %}
<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">
<span class="question__title__copy">{{ rubric_feedback_prompt }}</span>
<span class="question__title__copy">{% trans rubric_feedback_prompt %}</span>
</label>
<div class="wrapper--input">
<textarea
id="{{ rubric_type }}__assessment__rubric__question--feedback__value"
class="assessment__rubric__question--feedback__value"
placeholder="{{ rubric_feedback_default_text }}"
placeholder="{% trans rubric_feedback_default_text %}"
maxlength="500"
>
</textarea>
......
......@@ -21,7 +21,7 @@
{% trans "View the file associated with this submission." %}
</a>
{% 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 %}
</div>
......
......@@ -3,16 +3,16 @@
{% load tz %}
{% 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 %}
{% block title %}
<span class="step__status">
<span class="step__status__label">{% trans "This step's status" %}:</span>
<span class="step__status__value">
<i class="icon fa fa-exclamation-triangle" aria-hidden="true"></i>
<span class="copy">{% trans "Cancelled" %}</span>
</span>
<span class="step__status__label">{% trans "This step's status" %}:</span>
<span class="step__status__value">
<i class="icon fa fa-exclamation-triangle" aria-hidden="true"></i>
<span class="copy">{% trans "Cancelled" %}</span>
</span>
</span>
{% endblock %}
......@@ -24,26 +24,17 @@
<h3 class="message__title">{% trans "Submission Cancelled" %}</h3>
<div class="message__content">
<p>
{% 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 }}
{% endblocktrans %}
<br>
<!-- Comments: Reason for Cancellation-->
{% blocktrans with comments=workflow_cancellation.comments %}
Comments: {{ comments }}
{% endblocktrans %}
</p>
</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>
<p>
{% 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 }}
{% endblocktrans %}
</p>
<p>
<!-- Comments: Reason for Cancellation-->
{% blocktrans with comments=workflow_cancellation.comments %}
Comments: {{ comments }}
{% endblocktrans %}
</p>
</div>
</div>
</div>
......
{% load tz %}
{% load i18n %}
{% spaceless %}
......@@ -6,7 +5,7 @@
<div class="ui-toggle-visibility__content">
<div class="wrapper--staff-assessment">
<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 class="step__content">
......@@ -42,6 +41,8 @@
<button type="submit" class="action action--submit is--disabled">
<span class="copy">{% trans "Submit your assessment" %}</span>
</button>
<div class="staff-override-error"></div>
</li>
</ul>
</div>
......
......@@ -231,7 +231,8 @@ class StaffAreaMixin(object):
Args:
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 = None
......@@ -269,8 +270,8 @@ class StaffAreaMixin(object):
example_based_assessment = None
self_assessment = None
peer_assessments = []
submitted_assessments = []
peer_assessments = None
submitted_assessments = None
if "peer-assessment" in assessment_steps:
peer_assessments = peer_api.get_assessments(submission_uuid)
......
......@@ -758,6 +758,68 @@
"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",
"context": {
"rubric_criteria": [
......
......@@ -4,6 +4,18 @@
describe('OpenAssessment.StaffAreaView', function() {
'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
var StubServer = function() {
this.studentTemplate = 'oa_student_info.html';
......@@ -43,10 +55,6 @@ describe('OpenAssessment.StaffAreaView', function() {
}).promise();
};
var successPromise = $.Deferred(
function(defer) { defer.resolve(); }
).promise();
this.cancelSubmission = function() {
return successPromise;
};
......@@ -300,21 +308,42 @@ describe('OpenAssessment.StaffAreaView', function() {
'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() {
var fillAssessment = function($assessment) {
$('#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();
});
};
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() {
var staffArea = createStaffArea(),
$assessment, $submitButton;
chooseStudent(staffArea, 'testStudent');
$assessment = $('.wrapper--staff-assessment', staffArea.element)
$assessment = $('.wrapper--staff-assessment', staffArea.element);
$submitButton = $('.action--submit', $assessment);
expect($submitButton).toHaveClass('is--disabled');
fillAssessment($assessment);
......@@ -323,24 +352,39 @@ describe('OpenAssessment.StaffAreaView', function() {
it('can submit a staff grade override', function() {
var staffArea = createStaffArea(),
$assessment, $submitButton;
$assessment, $gradeSection;
chooseStudent(staffArea, 'testStudent');
$assessment = $('.wrapper--staff-assessment', staffArea.element)
$submitButton = $('.action--submit', $assessment);
$assessment = $('.wrapper--staff-assessment', staffArea.element);
fillAssessment($assessment);
// Submit the assessment
server.studentTemplate = 'oa_staff_cancelled_submission.html';
$submitButton.click();
// Verify that the student info reflects the update
expect($($('.staff-info__student__response p', staffArea.element)[0]).text().trim()).toBe(
'Learner submission removed by staff on October 1, 2015 04:53 UTC'
);
expect($($('.staff-info__student__response p', staffArea.element)[1]).text().trim()).toBe(
'Comments: Cancelled!'
server.studentTemplate = 'oa_staff_graded_submission.html';
submitAssessment(staffArea);
// Verify that the student info is visible and shows the correct score
$gradeSection = $('.staff-info__student__grade', staffArea.element);
expect($('.ui-toggle-visibility', $gradeSection)).not.toHaveClass('is--collapsed');
expect($('p', $gradeSection).first().text().trim()).toBe(
'Final grade: 1 out of 2'
);
});
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 = {
return !button.hasClass('is--disabled');
} else {
button.toggleClass('is--disabled', !enabled);
return enabled;
}
},
......
......@@ -169,6 +169,7 @@ OpenAssessment.ResponseView.prototype = {
return !sel.hasClass('is--disabled');
} else {
sel.toggleClass('is--disabled', !enabled);
return enabled;
}
},
......
......@@ -91,6 +91,7 @@ OpenAssessment.SelfView.prototype = {
return !button.hasClass('is--disabled');
} else {
button.toggleClass('is--disabled', !enabled);
return enabled;
}
},
......
......@@ -231,7 +231,7 @@ class TestCourseStaff(XBlockHandlerTestCase):
path, context = xblock.get_student_info_path_and_context("Bob")
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)
@scenario('data/basic_scenario.xml', user_id='Bob')
......
......@@ -399,7 +399,7 @@ class StaffAreaTest(OpenAssessmentTest):
self.staff_area_page.verify_learner_final_score(
"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."
)
......
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