Sort attachments by name
Description
Attachments
is related to
Activity

Adam Marshall March 10, 2024 at 8:34 PM
sakai 23
and how they are presented

Matthew Jones March 1, 2024 at 1:39 AMEdited
Sorry I didn’t notice it was a SyllabusAttachment
object in there. Passing the AlphaNumericComparator
into this would make it not use the compareTo
in this object.
By guess is we’d probably have to use this AlphaNumericComparator
directly in the compareTo
method of SyllabusAttachment
right? Something like this in SyllabusAttachment.java
.
Thanks for trying it out. I think if QA is happy this can just be left as it is. I don’t think it needs to be improved.

Daniel Merino February 29, 2024 at 11:16 AM
I have done a quick test and it seems it’s not as easy as adding the new comparator to sort():
Caused by: java.lang.ClassCastException: class org.sakaiproject.api.app.syllabus.SyllabusAttachment cannot be cast to class java.lang.String (org.sakaiproject.api.app.syllabus.SyllabusA
ttachment is in unnamed module of loader java.net.URLClassLoader @1786f9d5; java.lang.String is in module java.base of loader 'bootstrap')
at org.sakaiproject.util.comparator.AlphaNumericComparator.compare(AlphaNumericComparator.java:23) ~[sakai-kernel-util-22.3.jar:22.3]
Also this is merged and verified, if you think it should be improved with the new comparator I think a new ticket should be created.

Matthew Jones February 22, 2024 at 11:57 PM
Sakai has AlphaNumericComparator.
I think you could switch to using this pretty quick by importing it and passing it in as a parameter to the Collections.sort. I believe that would provide a sorted list that better matches the description here.

Andrea Schmidt February 22, 2024 at 11:27 PM
Will set it to verified based on comments and discussed at QA meeting.
Details
Details
Priority
Affects versions
Fix versions
23 Status
22 Status
Components
Assignee

Reporter

Syllabus attached items are ordered by internal ID, so teachers are annoyed they can’t present the attachments in a logical order, even if they name the items with “1-”, “2-”, etc.
Attachments should be ordered by name. This can be done with a simple low-risk change.