Skip to content

Commit

Permalink
SAK-41529 Re-added assignment tool graded item support (sakaiproject#…
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianfish authored Mar 22, 2019
1 parent 49ef381 commit a07bb07
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
import org.sakaiproject.service.gradebook.shared.GradebookInformation;
import org.sakaiproject.service.gradebook.shared.GradingType;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class GradeSummaryTablePanel extends BasePanel {

private static final long serialVersionUID = 1L;
Expand Down Expand Up @@ -334,25 +337,37 @@ public boolean isVisible() {

gradeScore.add(sakaiRubricPreview);
} else {

gradeScore.add(
new Label("grade", FormatHelper.convertEmptyGradeToDash(FormatHelper.formatGradeForDisplay(rawGrade))));
gradeScore.add(new Label("outOf",
new StringResourceModel("label.studentsummary.outof", null, assignment.getPoints())));

final WebMarkupContainer sakaiRubricPreview = new WebMarkupContainer("sakai-rubric-student-button");
sakaiRubricPreview.add(AttributeModifier.append("display", "icon"));
sakaiRubricPreview.add(AttributeModifier.append("tool-id", RubricsConstants.RBCS_TOOL_GRADEBOOKNG));
sakaiRubricPreview.add(AttributeModifier.append("evaluated-item-id", assignment.getId() + "." + studentUuid));
sakaiRubricPreview.add(AttributeModifier.append("token", rubricsService.generateJsonWebToken(RubricsConstants.RBCS_TOOL_GRADEBOOKNG)));

if (!showingStudentView && (GradeSummaryTablePanel.this.getUserRole() == GbRole.INSTRUCTOR
|| GradeSummaryTablePanel.this.getUserRole() == GbRole.TA)) {
sakaiRubricPreview.add(AttributeModifier.append("instructor", true));
}

if (assignment.getId() != null) {
sakaiRubricPreview.add(AttributeModifier.append("entity-id", assignment.getId()));
if (assignment.isExternallyMaintained()) {
sakaiRubricPreview.add(AttributeModifier.append("tool-id", RubricsConstants.RBCS_TOOL_ASSIGNMENT));
String[] bits = assignment.getExternalId().split("/");
if (bits != null && bits.length >= 1) {
String assignmentId = bits[bits.length-1];
sakaiRubricPreview.add(AttributeModifier.append("evaluated-item-id", studentUuid));
sakaiRubricPreview.add(AttributeModifier.append("entity-id", assignmentId));//this only works for Assignments atm
} else {
log.warn(assignment.getExternalId() + " is not a valid assignment reference");
}
} else {
sakaiRubricPreview.add(AttributeModifier.append("tool-id", RubricsConstants.RBCS_TOOL_GRADEBOOKNG));
sakaiRubricPreview.add(AttributeModifier.append("evaluated-item-id", assignment.getId() + "." + studentUuid));

if (assignment.getId() != null) {
sakaiRubricPreview.add(AttributeModifier.append("entity-id", assignment.getId()));
}
}

gradeScore.add(sakaiRubricPreview);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ export class SakaiRubricCriterionStudent extends SakaiElement {
${!this.preview ? html`
<sakai-rubric-student-comment criterion="${JSON.stringify(c)}"></sakai-rubric-student-comment>
<strong class="points-display ${this.getOverriddenClass(c.pointoverride,c.selectedvalue)}">
&nbsp;
${c.selectedvalue}
${!c.selectedRatingId ? "0" : ""}
&nbsp;
Expand Down Expand Up @@ -105,8 +104,10 @@ export class SakaiRubricCriterionStudent extends SakaiElement {

var selectedRatingItem;
c.ratings.forEach(r => {
r.selected = (r.id == ed.selectedRatingId);
selectedRatingItem = r;
if (r.id == ed.selectedRatingId) {
r.selected = true;
selectedRatingItem = r;
}
});

c.selectedRatingId = ed.selectedRatingId;
Expand All @@ -126,13 +127,13 @@ export class SakaiRubricCriterionStudent extends SakaiElement {
this.updateTotalPoints();
}

isOverridden(ovrdvl, selected) {
isOverridden(pointoverride, selected) {

if (!this.rubricAssociation.parameters.fineTunePoints) {
return false;
}

if ((ovrdvl || ovrdvl === 0) && (parseInt(ovrdvl) !== parseInt(selected))) {
if ((pointoverride || pointoverride === 0) && (parseInt(pointoverride) !== parseInt(selected))) {
return true;
} else {
return false;
Expand Down

0 comments on commit a07bb07

Please sign in to comment.