learningequality / kolibri

Kolibri Learning Platform: the offline app for universal education
https://learningequality.org/kolibri/
MIT License
757 stars 637 forks source link

Implement backend sorting of users data for Facility -> Users table #12234

Open MisRob opened 1 month ago

MisRob commented 1 month ago

Overview

To be able to add sorting for Facility -> Users table as designed here

table

backend needs to be able to return sorted data.

Backend sorting is expected to work for:

Note that sorting in this case can't be done on frontend as here we use paginated data that is loaded lazily.

Outcomes

Out of scope

MisRob commented 1 month ago

This is related place in code https://github.com/learningequality/kolibri/blob/develop/kolibri/plugins/facility/assets/src/views/UserPage/index.vue#L38-L45

rtibbles commented 1 month ago

This would need to be done using the OrderingFilter defined here: https://github.com/learningequality/kolibri/blob/develop/kolibri/core/api.py#L58

Which is a reimplementation of the DRF OrderingFilter documented here: https://www.django-rest-framework.org/api-guide/filtering/#orderingfilter

It should work fairly easily out of the box.

MisRob commented 3 weeks ago

Also note that I think that as part of this work, "date_created" and "date_added" will need to be added to the facility users response (endpoint api/auth/facilityuser/?member_of=37b644ecd03062f21a54452f84cfadb6&page=1&page_size=30). I originally assumed we may have it available already, but is not the case:

Screenshot from 2024-06-13 10-13-38

MisRob commented 3 weeks ago

As agreed with @ozer550 and @rtibbles, I removed "Date added" requirements since that is currently not available on backend