// ---------------------------------------------------------- public WOComponent editNewerSubmissionScore() { WCComponent destination = null; if (!hasMessages()) { if (aNewerSubmission == null) { log.error("editNewerSubmissionScore(): null submission!"); } else if (aNewerSubmission.result() == null) { log.error("editNewerSubmissionScore(): null submission result!"); log.error("student = " + aNewerSubmission.user().userName()); } prefs().setSubmissionRelationship(aNewerSubmission); // destination = pageWithName(GradeStudentSubmissionPage.class); destination = (WCComponent) super.next(); if (destination instanceof GradeStudentSubmissionPage) { GradeStudentSubmissionPage page = (GradeStudentSubmissionPage) destination; if (aUserSubmission != null) { page.availableSubmissions = userGroup().displayedObjects().immutableClone(); page.thisSubmissionIndex = page.availableSubmissions.indexOf(aUserSubmission); } } destination.nextPage = this; } return destination; }
// ---------------------------------------------------------- public WOComponent repartner() { for (UserSubmissionPair pair : userGroup().allObjects()) { Submission sub = pair.submission(); if (sub != null && sub.result() != null) { for (Submission psub : sub.result().submissions()) { if (psub != sub && psub.assignmentOffering().assignment() != sub.assignmentOffering().assignment()) { log.warn( "found partner submission " + psub.user() + " #" + psub.submitNumber() + "\non incorrect assignment offering " + psub.assignmentOffering()); NSArray<AssignmentOffering> partnerOfferings = AssignmentOffering.objectsMatchingQualifier( localContext(), AssignmentOffering.courseOffering .dot(CourseOffering.course) .eq(sub.assignmentOffering().courseOffering().course()) .and( AssignmentOffering.courseOffering .dot(CourseOffering.students) .eq(psub.user())) .and( AssignmentOffering.assignment.eq( sub.assignmentOffering().assignment()))); if (partnerOfferings.count() == 0) { log.error( "Cannot locate correct assignment " + "offering for partner" + psub.user() + " #" + psub.submitNumber() + "\non incorrect assignment offering " + psub.assignmentOffering()); } else { if (partnerOfferings.count() > 1) { log.warn( "Multiple possible offerings for " + "partner " + psub.user() + " #" + psub.submitNumber() + "\non incorrect assignment offering " + psub.assignmentOffering()); for (AssignmentOffering ao : partnerOfferings) { log.warn("\t" + ao); } } psub.setAssignmentOfferingRelationship(partnerOfferings.get(0)); } } } } } applyLocalChanges(); return null; }