Skip to content

Commit

Permalink
SAK-41703: assignments > fix scoring component icons for instructor v…
Browse files Browse the repository at this point in the history
  • Loading branch information
bjones86 authored Apr 23, 2019
1 parent b248bbc commit ea1456f
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14675,7 +14675,7 @@ private String getAssignmentStatus(String assignmentId, SessionState state) {
*/
protected void setScoringAgentProperties(Context context, Assignment assignment, AssignmentSubmission submission, boolean gradeView) {
String associatedGbItem = assignment.getProperties().get(PROP_ASSIGNMENT_ASSOCIATE_GRADEBOOK_ASSIGNMENT);
if (submission != null && StringUtils.isNotBlank(associatedGbItem) && assignment.getTypeOfGrade() == SCORE_GRADE_TYPE) {
if (!assignment.getIsGroup() && submission != null && StringUtils.isNotBlank(associatedGbItem) && assignment.getTypeOfGrade() == SCORE_GRADE_TYPE) {
ScoringService scoringService = (ScoringService) ComponentManager.get("org.sakaiproject.scoringservice.api.ScoringService");
ScoringAgent scoringAgent = scoringService.getDefaultScoringAgent();

Expand All @@ -14684,9 +14684,8 @@ protected void setScoringAgentProperties(Context context, Assignment assignment,
Set<AssignmentSubmissionSubmitter> submitters = submission.getSubmitters();
String currentUser = sessionManager.getCurrentSessionUserId();
AssignmentSubmissionSubmitter submitter = submitters.stream()
.filter(s -> s.getSubmitter().equals(currentUser)).findAny()
.orElseGet(() -> submitters.stream()
.filter(AssignmentSubmissionSubmitter::getSubmittee).findAny()
.filter(s -> s.getSubmitter().equals(currentUser)).findAny() // If in student context, get student's specific submission
.orElseGet(() -> submitters.stream().findAny() // If in instructor context, just get the first available submission (group assignments don't show the icon anyway)
.orElse(null));

if (scoringAgentEnabled && submitter != null) {
Expand Down Expand Up @@ -14726,7 +14725,7 @@ protected void setScoringAgentProperties(Context context, Assignment assignment,
// Determine if a scoring component (like a rubric) has been associated with this gradebook item
ScoringComponent component = scoringService.getScoringComponent(
scoringAgent.getAgentId(), gradebookUid, gbItemId);
boolean scoringComponentEnabled = component != null && !assignment.getIsGroup();
boolean scoringComponentEnabled = component != null;

context.put("scoringComponentEnabled", scoringComponentEnabled);

Expand Down

0 comments on commit ea1456f

Please sign in to comment.