Missed Blocks and APR is not available to sort using out current endpoint because it don't have theses params.
I can see 2 solutions for that , depends on how we want sorting to be handled.
Handle sorting with out current get_witnesses request and update backend to have ability to sort by missed_blocks and APR which is hbd_interest_rate. Keep in mind that this will sort all data, not only visible data on the table which is 200 (which we probably want)
Handle sorting in front end and all necessary logic to make sorting work with each table cell.
Yes, I agree this is better done in the backend. I've created an issue (which includes point that we should change this from "missed_blocks" to missed_blocks_in_last_week).
@lbudginas It looks like you already implemented with option 2? If so, maybe I should merge it for now, and leave the issue open for whenever we have time to update the backend?
@lbudginas based on current merge and till Missed_blocks and APR are made available, could you disable sorting on those two columns as clicking the header is causing infinite loader on the page.
I did notice also tons of results coming back after implementing backend sorting (try sorting by name), not sure of the validity of those results? maybe we have tons of witnesses that are no longer active?
Also there is no pagination available so many useful results are lost
Add to that, the experience in sorting is slow due to trips back to server, which is why i tend to think client-side sorting would be better given the interest in the current list of witnesses i/o the data shown below?
I agree we should just disable the slow ones until backend supports it.
As to validity of sorting by name, I think a bunch of witnesses got registered that never did anything. We should probably consider filtering out witnesses that never generated a block (probably something the backend should do).
Pagination will probably need to wait for backend.
@mcfarhat if we want sorting on client side, we will need to add pagination, then each page could be sorted mush faster. Without pagination , using sorting on client-side user will be limited only to those visible (200 at the time) witnesses, so he won't see users let's say who has 0 votes or voters etc. So we need to decide how do we want to do it
My reasoning is that we could only be interested in the currently displayed list, without the need for pagination, unless we want to display ALL witnesses (which might not make sense nor be useful).
So displaying all witnesses -> pagination -> server-side essential
Displaying ranked witnesses (which is the norm currently on hivescan and other witness front ends) -> no need for pagination and client