Skip to content

Commit

Permalink
SAK-40851 Assignments: Allow Students to use Rubrics for the Peer
Browse files Browse the repository at this point in the history
SAK-40851 Assignments: Allow Students to use Rubrics for the Peer


SAK-40851 Assignments: Allow Students to use Rubrics for the Peer


SAK-40851 Assignments: Allow Students to use Rubrics for the Peer


SAK-40851 Assignments: Allow Students to use Rubrics for the Peer


SAK-40851 Assignments: Allow Students to use Rubrics for the Peer


SAK-40851 Assignments: Allow Students to use Rubrics for the Peer


SAK-40851 Assignments: Allow Students to use Rubrics for the Peer


SAK-40851 Assignments: Allow Students to use Rubrics for the Peer


SAK-40851 Assignments: Allow Students to use Rubrics for the Peer


SAK-40851 Assignments: Allow Students to use Rubrics for the Peer


SAK-40851 Assignments: Allow Students to use Rubrics for the Peer


SAK-40851 Assignments: Allow Students to use Rubrics for the Peer


SAK-40851 Assignments: Allow Students to use Rubrics for the Peer


SAK-40851 Assignments: Allow Students to use Rubrics for the Peer


SAK-40851 Assignments: Allow Students to use Rubrics for the Peer
  • Loading branch information
MRutea committed Nov 23, 2020
1 parent e3af228 commit 195543d
Show file tree
Hide file tree
Showing 16 changed files with 283 additions and 36 deletions.
5 changes: 5 additions & 0 deletions assignment/api/src/resources/assignment.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1114,8 +1114,13 @@ associate.label=Use the following rubric to grade this assignment
option.pointsoverride=Adjust individual student scores
option.hidepoints=Hide point values (feedback only)
option.studentpreview=Hide Rubric from student
option.selfreport=Allow students to self-report their work
grading_rubric=Grading Rubric
asn.list.userubric=This assignment could be graded using a Rubric
youmustrubric=This is a self-report assignment. You must use the following rubric to grade your work before submitting
studentrubric=This is a self-report assignment. You can check the self-report of submitter before grading.
reviewrubric=This is a self-report assignment. You can check your self-report before grading.
peerrubric=Before grading the student, you can check the peer gradings above.
rubrics.use=Use rubric

# table toolbar common messages
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@
import org.sakaiproject.exception.ServerOverloadException;
import org.sakaiproject.javax.PagingPosition;
import org.sakaiproject.message.api.MessageHeader;
import org.sakaiproject.rubrics.logic.model.ToolItemRubricAssociation;
import org.sakaiproject.rubrics.logic.RubricsConstants;
import org.sakaiproject.rubrics.logic.RubricsService;
import org.sakaiproject.scoringservice.api.ScoringAgent;
Expand Down Expand Up @@ -1056,6 +1057,10 @@ public class AssignmentAction extends PagedResourceActionII {
* Site property for forcing anonymous grading in a site
*/
private static final String SAK_PROP_FORCE_ANON_GRADING = "assignment.anon.grading.forced";
/**
* submittee, the student who do a selfreport
*/
private static final String STUDENT_WITH_SELFREPORT = "submittee";

private static final String FLAG_ON = "on";
private static final String FLAG_TRUE = "true";
Expand Down Expand Up @@ -1761,6 +1766,8 @@ private String build_student_view_submission_context(VelocityPortlet portlet, Co
canViewAssignmentIntoContext(context, assignment, s);

addAdditionalNotesToContext(submitter, context, state);

assignmentToolUtils.hasRubricSelfReview(context, assignment.getId());
}

if (taggingManager.isTaggable() && assignment != null) {
Expand Down Expand Up @@ -2284,6 +2291,14 @@ protected String build_student_confirm_submission_context(VelocityPortlet portle
}
}

User submitter = (User) state.getAttribute("student");
if (submitter == null) {
submitter = user;
}
context.put(STUDENT_WITH_SELFREPORT, submitter);

assignmentToolUtils.hasRubricSelfReview(context, assignment.getId());

context.put("text", state.getAttribute(PREVIEW_SUBMISSION_TEXT));
Map<String, Reference> submissionAttachmentReferences = new HashMap<>();
stripInvisibleAttachments(state.getAttribute(PREVIEW_SUBMISSION_ATTACHMENTS)).forEach(r -> submissionAttachmentReferences.put(r.getId(), r));
Expand Down Expand Up @@ -2543,6 +2558,14 @@ protected String build_student_view_grade_context(VelocityPortlet portlet, Conte
}
}
context.put("NamePropContentReviewOptoutUrl", ContentReviewConstants.URKUND_OPTOUT_URL);

User submitter = (User) state.getAttribute("student");
if (submitter == null) {
submitter = userDirectoryService.getCurrentUser();
}
context.put(STUDENT_WITH_SELFREPORT, submitter);

assignmentToolUtils.hasRubricSelfReview(context, assignment.getId());
}

if (taggingManager.isTaggable() && submission != null) {
Expand Down Expand Up @@ -3581,6 +3604,18 @@ protected String build_instructor_grade_submission_context(VelocityPortlet portl
}
context.put("value_grades", grades);
}

// Check if the assignment has a rubric associated or not
context.put(RubricsConstants.HAS_ASSOCIATED_RUBRIC, rubricsService.hasAssociatedRubric(RubricsConstants.RBCS_TOOL_ASSIGNMENT, a.getId()));
if (assignmentToolUtils.hasRubricSelfReview(context, a.getId())) {
s.getSubmitters().stream().findAny().ifPresent(u -> context.put(STUDENT_WITH_SELFREPORT, u.getSubmitter()));
}
if (a.getAllowPeerAssessment()) {
List<PeerAssessmentItem> reviews = assignmentPeerAssessmentService.getPeerAssessmentItems(s.getId(), a.getScaleFactor());
if(reviews.size() > 1) { log.warn("More than one peer review were found for Rubric assignment"); }
reviews.stream().findFirst().ifPresent(pai -> context.put(STUDENT_WITH_SELFREPORT, pai.getId().getAssessorUserId()));
}

}

// show alert if student is working on a draft
Expand Down Expand Up @@ -3823,9 +3858,6 @@ protected String build_instructor_grade_submission_context(VelocityPortlet portl
// letter grading
letterGradeOptionsIntoContext(context);

// Check if the assignment has a rubric associated or not
context.put("hasAssociatedRubric", assignment.isPresent() && rubricsService.hasAssociatedRubric(RubricsConstants.RBCS_TOOL_ASSIGNMENT, assignment.get().getId()));

if (state.getAttribute(RUBRIC_STATE_DETAILS) != null) {
context.put(RUBRIC_STATE_DETAILS, state.getAttribute(RUBRIC_STATE_DETAILS));
}
Expand Down Expand Up @@ -4809,6 +4841,9 @@ private String build_student_review_edit_context(VelocityPortlet portlet, Contex
securityService.popAdvisor(secAdv);
}
}

context.put(RubricsConstants.HAS_ASSOCIATED_RUBRIC, rubricsService.hasAssociatedRubric(RubricsConstants.RBCS_TOOL_ASSIGNMENT, assignment.getId()));

if (s != null) {
submissionId = s.getId();
context.put("submission", s);
Expand Down Expand Up @@ -4869,7 +4904,7 @@ private String build_student_review_edit_context(VelocityPortlet portlet, Contex
} else {
context.put("view_only", false);
}

context.put(RubricsConstants.ASSESSOR_ID, peerAssessmentItem.getId().getAssessorUserId());
// get attachments for peer review item
List<PeerAssessmentAttachment> attachments = assignmentPeerAssessmentService.getPeerAssessmentAttachments(peerAssessmentItem.getId().getSubmissionId(), peerAssessmentItem.getId().getAssessorUserId());
List<Reference> attachmentRefList = new ArrayList<>();
Expand Down Expand Up @@ -6972,6 +7007,8 @@ private void setNewAssignmentParameters(RunData data, boolean validify) {
} catch (Exception e) {
addAlert(state, rb.getString("peerassessment.invalidNumReview"));
}
} else if (params.get(RubricsConstants.RBCS_ASSOCIATE).equals("1")) {
state.setAttribute(NEW_ASSIGNMENT_PEER_ASSESSMENT_NUM_REVIEWS, 1);
} else {
addAlert(state, rb.getString("peerassessment.specifyNumReview"));
}
Expand Down Expand Up @@ -9221,7 +9258,7 @@ public void doView_assignment_as_student(RunData data) {
public void doView_submissionReviews(RunData data) {
String submissionId = data.getParameters().getString("submissionId");
SessionState state = ((JetspeedRunData) data).getPortletSessionState(((JetspeedRunData) data).getJs_peid());
String assessorId = data.getParameters().getString("assessorId");
String assessorId = data.getParameters().getString(RubricsConstants.ASSESSOR_ID);
String assignmentId = StringUtils.trimToNull(data.getParameters().getString("assignmentId"));
Assignment a = getAssignment(assignmentId, "doEdit_assignment", state);
if (submissionId != null && !"".equals(submissionId) && a != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,12 @@
import org.sakaiproject.assignment.api.model.Assignment;
import org.sakaiproject.assignment.api.model.AssignmentSubmission;
import org.sakaiproject.assignment.api.model.AssignmentSubmissionSubmitter;
import org.sakaiproject.cheftool.Context;
import org.sakaiproject.entity.api.Reference;
import org.sakaiproject.exception.PermissionException;
import org.sakaiproject.rubrics.logic.RubricsConstants;
import org.sakaiproject.rubrics.logic.RubricsService;
import org.sakaiproject.rubrics.logic.model.ToolItemRubricAssociation;
import org.sakaiproject.service.gradebook.shared.AssignmentHasIllegalPointsException;
import org.sakaiproject.service.gradebook.shared.ConflictingAssignmentNameException;
import org.sakaiproject.service.gradebook.shared.GradebookExternalAssessmentService;
Expand Down Expand Up @@ -883,4 +885,17 @@ private void removeNonAssociatedExternalGradebookEntry(String context, String as
}
}

public boolean hasRubricSelfReview(Context context, String assignmentId) {
try {
Optional<ToolItemRubricAssociation> rubricAssociation = rubricsService.getRubricAssociation(RubricsConstants.RBCS_TOOL_ASSIGNMENT, assignmentId);
if (rubricAssociation.isPresent() && rubricAssociation.get().getParameter(RubricsConstants.STUDENT_SELF_REPORT)) {
context.put("rubricSelfReport", true);
return true;
}
} catch (Exception e) {
log.warn("Error trying to retrieve rubrics association for assignment : {}", e.getMessage());
}
return false;
}

}
4 changes: 4 additions & 0 deletions assignment/tool/src/webapp/js/assignments.js
Original file line number Diff line number Diff line change
Expand Up @@ -979,4 +979,8 @@ $(document).ready(function() {
saveButton && saveButton.addEventListener("click", saveRubric);
const returnButton = document.getElementById("save-and-return");
returnButton && returnButton.addEventListener("click", saveRubric);
const confirmButton = document.getElementById("confirm");
confirmButton && confirmButton.addEventListener("click", saveRubric);
const postButton = document.getElementById("post");
postButton && postButton.addEventListener("click", saveRubric);
});
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,22 @@
#if ($!hasAssociatedRubric)
</div>
<div role="tabpanel" class="tab-pane" id="rubric">
#if($assignment.getAllowPeerAssessment() || $!rubricSelfReport)
<sakai-rubric-student
token="$!rbcs-token"
tool-id="sakai.assignment"
entity-id="$assignment.Id"
evaluated-item-id="$submittee"
></sakai-rubric-student>
<p class="help-block">
#if($assignment.getAllowPeerAssessment())
$tlang.getString("peerrubric")
#elseif($!rubricSelfReport)
$tlang.getString("studentrubric")
#end
</p>
<hr class="itemSeparator" />
#end
<sakai-rubric-grading
## grade-field-id="grade"
token="$!rbcs-token"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,13 @@ function printView(url) {
#end
</span>
</a>
<sakai-rubric-student-button
token="$!rbcs-token"
tool-id="sakai.assignment"
evaluated-item-id="$!item.getId().getAssessorUserId()"
entity-id="$assignment.Id"
instructor="true">
</sakai-rubric-student-button>
#if($!item.getScoreDisplay().length() > 0 || ($!item.getComment() && $!item.getComment().trim().length() > 0))
<span class="highlight" #if($item.Removed) style="text-decoration: line-through" #end>
#if($item.isDraft())
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<!-- start: chef_assignments_student_confirm_submission.vm -->
#rubricsRequirements
###header_append("<script type=${quote}text/javascript${quote}>includeWebjarLibrary(${quote}bootstrap${quote});</script>")

<script>
Expand Down Expand Up @@ -115,6 +116,19 @@
</tr>
#end
</table>

#if ($!rubricSelfReport)
<p class="instruction">
$tlang.getString("reviewrubric")
</p>
<sakai-rubric-student
token="$!rbcs-token"
tool-id="sakai.assignment"
entity-id="$assignment.Id"
evaluated-item-id="$submittee.Id"
></sakai-rubric-student>
#end

<h4>
$tlang.getString("gen.submission")
</h4>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
<!-- start: check_assignments_instructor_grading_submission.vm -->
#rubricsRequirements
#module("/rubrics-service/webcomponents/rubric-association-requirements.js")
<script type="text/javascript">
focus_path = [ '$fField' ];
$(document).ready(function(){
ASN.setupPeerReviewAttachment();
});
</script>

<div class="portletBody">
#navBarOnClick( $allowAddAssignment $withGrade $allowGradeSubmission $allowAddAssignment $allowRecoverAssignment $allowAllGroups $assignmentscheck $allowUpdateSite $enableViewOption $view "gradeForm" "" )
## confirmation
Expand Down Expand Up @@ -158,6 +161,27 @@
#end

#if ($withGrade)
#if ($!hasAssociatedRubric)
#if ($!view_only)
<sakai-rubric-student
token="$!rbcs-token"
tool-id="sakai.assignment"
entity-id="$assignment.Id"
evaluated-item-id="$assessorId"
></sakai-rubric-student>
#else
<sakai-rubric-grading
token="$!rbcs-token"
tool-id="sakai.assignment"
entity-id="$assignment.Id"
evaluated-item-id="$assessorId"
isPeerOrSelf="true"
#if($rbcs-state-details && "$!rbcs-state-details" != "")
state-details="$rbcs-state-details"
#end
></sakai-rubric-grading>
#end
#end
<div class="highlightPanel" style="width:80%">
#set ($gradeType = $assignment.TypeOfGrade.ordinal())
<p class="shorttext">
Expand Down Expand Up @@ -319,7 +343,7 @@
<input type="button" accesskey="s" name="return" value="$tlang.getString('peerassessment.removereview')" onclick="SPNR.disableControlsAndSpin( this, null ); ASN.submitForm( 'gradeForm', 'toggleremove_review', '$formattedText.escapeUrl($submissionReference)', null ); return false;" title="$tlang.getString("peerassessment.removereview")" />
#end
#else
<input type="button" accesskey="s" name="return" value="$tlang.getString('gen.sav')" onclick="SPNR.disableControlsAndSpin( this, null ); ASN.submitForm( 'gradeForm', 'savegrade_review', '$formattedText.escapeUrl($submissionReference)', null ); return false;" title="$tlang.getString("gen.sav")" />
<input type="button" id="save" accesskey="s" name="return" value="$tlang.getString('gen.sav')" onclick="SPNR.disableControlsAndSpin( this, null ); ASN.submitForm( 'gradeForm', 'savegrade_review', '$formattedText.escapeUrl($submissionReference)', null ); return false;" title="$tlang.getString("gen.sav")" />
<input type="button" accesskey="x" name="cancel" value="$tlang.getString('cancel_changes')" onclick="SPNR.disableControlsAndSpin( this, null ); ASN.submitForm( 'gradeForm', 'cancelgrade_review', null, null ); return false;" />
<input type="button" id="post" name="returnSubmit" value="$tlang.getString('gen.subm3')" onclick="SPNR.disableControlsAndSpin( this, null ); ASN.submitForm( 'gradeForm', 'submitgrade_review', '$formattedText.escapeUrl($submissionReference)', null ); return false;" title="$tlang.getString("gen.subm3")" />
#end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,16 @@
entity-id="$assignment.Id"
evaluated-item-id="$submission.Id"
></sakai-rubric-student>
#elseif ($!rubricSelfReport)
<sakai-rubric-student
token="$!rbcs-token"
tool-id="sakai.assignment"
entity-id="$assignment.Id"
evaluated-item-id="$submittee.Id"
></sakai-rubric-student>
<p class="instruction">
$tlang.getString("reviewrubric")
</p>
#end

## show instructor comment if the submission is (1) graded and release or (2) returned
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,20 @@ $(document).ready(function(){
$('.cloned a').show();
ASN.resizeFrame('grow');
});


$('body').on('rubrics-grading-loaded', e => {
if($('.sakai-rubric-criteria-grading').length) {
$('#confirm').attr('disabled','disabled');
$('#preview').attr('disabled','disabled');
$('#save').attr('disabled','disabled');
$('body').on('rubric-ratings-changed', e => {
$('#confirm').removeAttr('disabled');
$('#preview').removeAttr('disabled');
$('#save').removeAttr('disabled');
});
}
});

});
</script>
## Include other javascript specific to this page
Expand Down Expand Up @@ -329,10 +342,13 @@ $(document).ready(function(){

#supplementItems($!allowViewModelAnswer $!allowReadAssignmentNoteItem $!allowViewAllPurposeItem $!assignmentModelAnswerItem $!assignmentNoteItem $!assignmentAllPurposeItem)

#if (!$!rubricSelfReport)
<sakai-rubric-student-preview-button
token="$!rbcs-token"
tool-id="sakai.assignment"
entity-id="$assignment.Id"></sakai-rubric-student-preview-button>
entity-id="$assignment.Id">
</sakai-rubric-student-preview-button>
#end

#if ($submission.Graded && ($submission.GradeReleased || $returned))
<sakai-rubric-student
Expand Down Expand Up @@ -406,6 +422,24 @@ $(document).ready(function(){
<input type="hidden" name="option" id="option" value="cancel" />
<input type="hidden" name="currentAttachment" value="" />
<input type="hidden" name="assignmentId" value="$assignmentReference" />

#if ($!rubricSelfReport)
<p class="instruction">
$tlang.getString("youmustrubric")
</p>
<sakai-rubric-grading
token="$!rbcs-token"
tool-id="sakai.assignment"
entity-id="$assignment.Id"
evaluated-item-id="$submitter.id"
evaluated-item-owner-id="$submitter.id"
isPeerOrSelf="true"

#if($rbcs-state-details && "$!rbcs-state-details" != "")
state-details="$rbcs-state-details"
#end
></sakai-rubric-grading>
#end

#if ($!canSubmit)
## if a draft submission or the submission has been returned and has not yet submitted
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ This section contains the options for grading this assignment, including rubrics
dont-associate-value="0" associate-label="$tlang.getString("associate.label")" associate-value="1" tool-id="sakai.assignment"
#if("$!assignment.Id" != "") entity-id="$assignment.Id" #end
#if($rbcs-state-details && "$!rbcs-state-details" != "") state-details="$rbcs-state-details" #end
fine-tune-points="$tlang.getString("option.pointsoverride")" hide-student-preview="$tlang.getString("option.studentpreview")">
fine-tune-points="$tlang.getString("option.pointsoverride")" hide-student-preview="$tlang.getString("option.studentpreview")"
student-self-report="$tlang.getString("option.selfreport")"
show-self-report-check="true">
</sakai-rubric-association>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ public interface RubricsConstants {
public static final String RBCS_LIST_SUFFIX = "rubricslist";
public static final String RBCS_LIST = RBCS_PREFIX + RBCS_LIST_SUFFIX;
public static final String RBCS_SOFT_DELETED = RBCS_PREFIX + "soft-deleted";
public static final String STUDENT_SELF_REPORT = "studentSelfReport";
public static final String HAS_ASSOCIATED_RUBRIC = "hasAssociatedRubric";
public static final String ASSESSOR_ID = "assessorId";

//samigo custom props
public static final String RBCS_PUBLISHED_ASSESSMENT_ENTITY_PREFIX = "pub.";
Expand Down
Loading

0 comments on commit 195543d

Please sign in to comment.