Add anonymous header to NGB assignment column

Denote anonymous assignments that have been published as "Anonymous" in
the New Gradebook column headers.

closes GRADE-1015

Test plan:
- Turn on Anonymous Moderated Marking and the new Anonymous Marking flag
  for a course.
- Create an assignment in the course with "anonymous grading" checked,
  and save/publish it.
- Create a second anonymous assignment, but leave it unpublished.
- Open new Gradebook for the course.
  - The column for first assignment you created should have "Anonymous"
    in the header in red.
  - The column for first assignment you created should have "Unpublished"
    in the header in red (unpublishedness should supersede anonymity).

Change-Id: I85ce9a6421cc75e21f1a2fd8e9d9e0aa51f1bbe1
Reviewed-on: https://gerrit.instructure.com/146220
Reviewed-by: Jeremy Neander <jneander@instructure.com>
Reviewed-by: Keith T. Garner <kgarner@instructure.com>
QA-Review: Jeremy Neander <jneander@instructure.com>
Product-Review: Sidharth Oberoi <soberoi@instructure.com>
Tested-by: Jenkins
This commit is contained in:
Adrian Packel 2018-04-06 15:41:04 -05:00
parent da62ebb95e
commit 0fc9946636
4 changed files with 36 additions and 2 deletions

View File

@ -37,17 +37,21 @@ import MessageStudentsWhoHelper from '../../../shared/helpers/messageStudentsWho
import ColumnHeader from './ColumnHeader' import ColumnHeader from './ColumnHeader'
function SecondaryDetailLine (props) { function SecondaryDetailLine (props) {
if (!props.assignment.published) { const anonymous = props.assignment.anonymousGrading;
const unpublished = !props.assignment.published;
if (anonymous || unpublished) {
return ( return (
<span className="Gradebook__ColumnHeaderDetailLine Gradebook__ColumnHeaderDetail--secondary"> <span className="Gradebook__ColumnHeaderDetailLine Gradebook__ColumnHeaderDetail--secondary">
<Text color="error" size="x-small" transform="uppercase" weight="bold"> <Text color="error" size="x-small" transform="uppercase" weight="bold">
{ I18n.t('Unpublished') } { unpublished ? I18n.t('Unpublished') : I18n.t('Anonymous') }
</Text> </Text>
</span> </span>
); );
} }
const pointsPossible = I18n.n(props.assignment.pointsPossible || 0); const pointsPossible = I18n.n(props.assignment.pointsPossible || 0);
return ( return (
<span className="Gradebook__ColumnHeaderDetailLine Gradebook__ColumnHeaderDetail--secondary"> <span className="Gradebook__ColumnHeaderDetailLine Gradebook__ColumnHeaderDetail--secondary">
<span className="assignment-points-possible"> <span className="assignment-points-possible">
@ -72,6 +76,7 @@ function SecondaryDetailLine (props) {
SecondaryDetailLine.propTypes = { SecondaryDetailLine.propTypes = {
assignment: shape({ assignment: shape({
anonymousGrading: bool.isRequired,
muted: bool.isRequired, muted: bool.isRequired,
pointsPossible: number, pointsPossible: number,
published: bool.isRequired published: bool.isRequired
@ -82,6 +87,7 @@ export default class AssignmentColumnHeader extends ColumnHeader {
static propTypes = { static propTypes = {
...ColumnHeader.propTypes, ...ColumnHeader.propTypes,
assignment: shape({ assignment: shape({
anonymousGrading: bool.isRequired,
courseId: string.isRequired, courseId: string.isRequired,
htmlUrl: string.isRequired, htmlUrl: string.isRequired,
id: string.isRequired, id: string.isRequired,

View File

@ -62,6 +62,7 @@ function getProps (column, gradebook, options) {
addGradebookElement: gradebook.keyboardNav.addGradebookElement, addGradebookElement: gradebook.keyboardNav.addGradebookElement,
assignment: { assignment: {
anonymousGrading: assignment.anonymous_grading,
courseId: assignment.course_id, courseId: assignment.course_id,
htmlUrl: assignment.html_url, htmlUrl: assignment.html_url,
id: assignment.id, id: assignment.id,

View File

@ -172,6 +172,18 @@ QUnit.module('AssignmentColumnHeaderRenderer', function (suiteHooks) {
equal(component.props.downloadSubmissionsAction, gradebook.getDownloadSubmissionsAction.returnValues[0]); equal(component.props.downloadSubmissionsAction, gradebook.getDownloadSubmissionsAction.returnValues[0]);
}); });
test('includes the assignment anonymous grading status when true', function () {
assignment.anonymous_grading = true;
render();
strictEqual(component.props.assignment.anonymousGrading, true);
});
test('includes the assignment anonymous grading status when false', function () {
assignment.anonymous_grading = false;
render();
strictEqual(component.props.assignment.anonymousGrading, false);
});
test('shows the "enter grades as" setting for a "points" assignment', function () { test('shows the "enter grades as" setting for a "points" assignment', function () {
assignment.grading_type = 'points'; assignment.grading_type = 'points';
render(); render();

View File

@ -737,6 +737,21 @@ QUnit.module('AssignmentColumnHeader: non-standard assignment', function (hooks)
strictEqual(secondaryDetail.text(), 'Unpublished'); strictEqual(secondaryDetail.text(), 'Unpublished');
}); });
test('renders an unpublished status when the assignment is unpublished and anonymously graded', function () {
props.assignment.published = false;
props.assignment.anonymousGrading = true;
wrapper = mountComponent(props);
const secondaryDetail = wrapper.find('.Gradebook__ColumnHeaderDetail--secondary');
strictEqual(secondaryDetail.text(), 'Unpublished');
});
test('renders an anonymous status when the assignment is anonymously graded', function() {
props.assignment.anonymousGrading = true;
wrapper = mountComponent(props);
const secondaryDetail = wrapper.find('.Gradebook__ColumnHeaderDetail--secondary');
strictEqual(secondaryDetail.text(), 'Anonymous');
});
test('does not render points possible when the assignment is unpublished', function () { test('does not render points possible when the assignment is unpublished', function () {
props.assignment.published = false; props.assignment.published = false;
wrapper = mountComponent(props); wrapper = mountComponent(props);