Skip to content
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

Merged
merged 4 commits into from
Jun 3, 2024

Conversation

stetsche
Copy link
Contributor

Copy link
Contributor

@bgarciaentornos bgarciaentornos left a 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.

Comment on lines -5768 to -5780
// 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());
Copy link
Contributor

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...

Copy link
Contributor

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?

Comment on lines -31 to -33
#if( !$hasAtLeastOneAnonAssignment )
#searchFilterPanel("$form_search", $searchString, "doView_submission_list_search", "doView_submission_list_search_clear")
#end
Copy link
Contributor

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.

Copy link
Contributor Author

@stetsche stetsche Apr 25, 2024

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

Copy link
Contributor Author

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>
Copy link
Contributor

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))
Copy link
Contributor

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.

Copy link
Contributor

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())

velocity/tool/src/templates/VM_chef_library.vm Outdated Show resolved Hide resolved
assignment/tool/src/webapp/js/assignmentsByStudent.js Outdated Show resolved Hide resolved
@@ -16757,4 +16773,12 @@ private String getRateSubmissionTimeSpent(AssignmentSubmission submission) {
}
return assignmentService.intToTime(assigmentRateSpent);
}

private Optional<User> getUser(String userId) {
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link
Contributor Author

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?

Copy link
Contributor

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

Copy link
Contributor

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.

Copy link
Contributor Author

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

@ern
Copy link
Contributor

ern commented Apr 26, 2024

Nice changes @stetsche

@ern ern changed the title Assignments Improve performance and UX of Assignments by student view SAK-49998 Assignments Improve performance and UX of Assignments by student view Apr 26, 2024
@ern ern changed the title SAK-49998 Assignments Improve performance and UX of Assignments by student view SAK-49998 Assignments improve performance and UX in assignments by student view Apr 26, 2024
@stetsche
Copy link
Contributor Author

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.

@stetsche stetsche marked this pull request as ready for review May 17, 2024 13:02
Copy link
Contributor Author

@stetsche stetsche left a 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.

Copy link
Contributor Author

@stetsche stetsche left a 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.

@ern ern merged commit 9854dae into sakaiproject:master Jun 3, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants