-
-
Notifications
You must be signed in to change notification settings - Fork 906
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SAK-49998 Assignments improve performance and UX in assignments by student view #12539
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fantastic work, thanks!
I just added some minor requests plus a few "think aloud" comments that probably don't need addressing.
// filter to obtain only grade-able assignments | ||
List<Assignment> rv = assignments.stream() | ||
.filter(a -> assignmentService.allowGradeSubmission(AssignmentReferenceReckoner.reckoner().assignment(a).reckon().getReference())) | ||
.collect(Collectors.toList()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we keep the comment? The variable is probably self-explaining but at the same time the comment gives an extra bit of purpose imo.
I was also wondering if the sort is necessary here, but yep, it's probably the best point. Assignments might not come ordered from the findAssignmentsBySite query and afterwards is just the loop so...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the hasAtLeastOneAnonAssigment has to be kept we could maybe merge both loops through the assignment variable?
#if( !$hasAtLeastOneAnonAssignment ) | ||
#searchFilterPanel("$form_search", $searchString, "doView_submission_list_search", "doView_submission_list_search_clear") | ||
#end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this actually be removed? The context variable is still added.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This removes the search field, which is replaced by the datatables search. I'll check if we can remove the context variable, or if it's used elsewhere
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might still need the variable and display a banner based on that condition.
#if ($!isTimesheet) | ||
<td headers="time"></td> | ||
#end | ||
<td headers="grade"></td> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix spacing
#end | ||
<td headers="grade"></td> | ||
</tr> | ||
#else | ||
#set($assignments=false) | ||
#set($assignments=$!studentAssignmentsTable.get($member)) | ||
#foreach ($assignment in $!assignments) | ||
#set ($assignmentReference = $!service.assignmentReference($assignment.Id)) | ||
#set ($isAnon = $!service.assignmentUsesAnonymousGrading($assignment)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if this could be done in a more efficient way, probably not and not worth it anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also checking the file there's this code that appear twice and maybe we could put together to avoid extra calls to the service:
#set ($submissionSubmitter = $!service.getSubmissionSubmittee($submission)) #if ($!submissionSubmitter.isPresent())
@@ -16757,4 +16773,12 @@ private String getRateSubmissionTimeSpent(AssignmentSubmission submission) { | |||
} | |||
return assignmentService.intToTime(assigmentRateSpent); | |||
} | |||
|
|||
private Optional<User> getUser(String userId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could move this into the UserDirectoryService. Maybe use the method "getOptionalUser"? We could perhaps use that naming pattern as a consistent way of overloading existing methods like getUser.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think it makes sense, but I didn't want to go so far. I'll do it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we could keep it inline in the stream (was it like that?), it's a tad uglier but doesn't need kernel updates
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a special "Master adjustments" commit on this branch, I would be fine with adding it there as well. Because I think this pattern makes sense and will be introduced at some point anyway. If we anticipate it now, we won't have duplicated code later. For 22 based branched this::getOptionalUser
and master userDirectoyService::getOptionalUser.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's fine. I would rephrase it as "Master master adjustments" though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with everyone here that adding a new method UserDirectoyService::getOptionalUser to return an Optional aka
public Optional<User> getOptionalUser(String userId)
I approve of the method name here, and the original method should be annotated as deprecated. (it's a shame that the return type is not part of a method signature)
this also has a positive side effect that the Exception UserNotDefinedException does not need to be thrown. TBH this was what returning NULL or Optional<> is for. An Exception is for communicating to the callee of the method with a return value other than Objects presence or absence is not to be trusted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did add the new method to UserDirectoryService, but I did not deprecate the original one yet
Nice changes @stetsche |
I could address some of the comments, but I have to move to a different project now. One of my colleagues will finish this. We also have found some cases to fix when testing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @JuanDavid102, thanks for continuing work on this! I added a few comments below.
assignment/tool/src/java/org/sakaiproject/assignment/tool/AssignmentAction.java
Outdated
Show resolved
Hide resolved
assignment/tool/src/java/org/sakaiproject/assignment/tool/AssignmentAction.java
Outdated
Show resolved
Hide resolved
...gnment/tool/src/webapp/vm/assignment/chef_assignments_instructor_student_list_submissions.vm
Outdated
Show resolved
Hide resolved
...gnment/tool/src/webapp/vm/assignment/chef_assignments_instructor_student_list_submissions.vm
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JuanDavid102 I added your latest changes and everything is looking good. Thanks for the great work!
Also rebased on master.
https://sakaiproject.atlassian.net/browse/SAK-49998