[User Settings] Sort/Filter Enrollments by Term in User Profile view

When pulling up a User's profile from the Admin view, it's a pain to figure out which courses they're enrolled in this term, because the list is only sorted alphabetically, not by Term or by which courses have been completed. 

If I could hide the completed enrollments or closed Terms - or at least sort the list so that the most recent Term shows up on top instead of mixed in - it would make things a lot easier when I'm trying to manage which courses my students are enrolled in each Term. 

Here's a screenshot of the view I'm talking about - you can see two different terms (2019-2020 and 2020-2021) mixed up:

canvasideas.jpg

18 Comments
joni
Community Explorer
Author

@jsimon3 you are a wizard my friend. If I could send you cookies I would. 

jsimon3
Community Participant

@joni I made a small tweak in the code. I am not sure if you grabbed it yet but I edited it 9/10/2020 at 9:00pm central time. and I will be waiting patiently for my cookie.

function sortCoursesPeopleView() {
  const checkIfNull = async (selector) => {
    while (document.querySelector(selector) === null) {
      await new Promise((resolve) => requestAnimationFrame(resolve));
    }
    return document.querySelector(selector);
  };
  checkIfNull("#user-info-fieldsets").then(() => {
    const enrollmentsFieldset = document.querySelector("#courses > #content");
    enrollmentsFieldset.setAttribute("style","resize: vertical; overflow: scroll; font-size: 0.8em; height:200px;");
    const subFieldset = document.querySelector("#courses_list > div > ul");
    subFieldset.setAttribute("style", "margin-left: 5px; font-size: 0.9em; margin-bottom: 10px; overflow:auto");

    let ulList = document.querySelector("#courses_list > div > ul");
    let items = ulList.querySelectorAll("li");

    for (
      let i = 0, arr = ["active", "completed", "unpublished"];
      i < arr.length;
      i++
    ) {
      for (let j = 0; j < items.length; j++) {
        if (~(" " + items[j].className + " ").indexOf(" " + arr[i] + " "))
          ulList.appendChild(items[j]);
      }
    }
  });
}sortCoursesPeopleView();
corey_mcneill
Community Explorer

@jsimon3  you have no idea how much this has made my day!! Thank you SO MUCH!!

dspiel
Community Participant

Long overdue and something that should be built into Canvas enrollment area.

canvas enrollments.jpg

nadine_heinz
Community Explorer

Great idea. Advanced filters would be much appreciated.

Code-with-Ski
Community Participant

@joni 

This is one of the features in the free Chrome extension that I have been developing as a side project.  It includes filters for the course published status, enrollment status, and term.  It also sorts the enrollments to have the active enrollments at the top of the list. Creating a Chrome Extension to Use with Canvas LMS 

Hopefully this becomes a native Canvas feature in the future.

KristinL
Community Team
Community Team
Status changed to: New
 
KristinL
Community Team
Community Team
Status changed to: Added to Theme