Sort assignments by numerical order

Jump to solution
FeliciaChen
Community Member

Hello, in Canvas' Assignments section, is there any way I can quickly sort the assignments in the numerical order? Thank you. 

Labels (2)
0 Likes
1 Solution
James
Community Champion

@FeliciaChen 

As @BrianLester mentioned, there is no automatic sorting within the web interface. The sorting is a manual sort. The order of the assignments is the order that you arrange them in (most people use drag/drop, but there's an accessible approach as well). The problem I've seen when importing or copying content is that sometimes it gets out of order and you need to manually re-order them.

You can change the order of the assignment using the Edit an assignment endpoint of the assignments API. The position property specifies where in the assignment group it should go.

I will caution about using the position property on any object (assignments, module items, etc) if you are making asynchronous API calls. I use Node JS, which allows me to send multiple requests without waiting for one to finish. Invariably, this causes a problem because the request get filled out of order and Canvas changes the order with each edit. That is, if you set something to position 25, you would need to make sure that positions 1-24 are already set (I've actually found it safer to do them in reverse order). If you use a programming language that waits for one request to finish before making the next (Python, PHP are two popular ones), then you should be safe.

View solution in original post