Add sort field to evalutor result filterset - #46
Merged
Merged
Conversation
schbetsy
reviewed
Mar 23, 2026
virginiacc
reviewed
Mar 26, 2026
Contributor
There was a problem hiding this comment.
@willbarton This looks great! 🎉
Looking at the list of fields, I realized I forgot about the consumer account number column in the evaluator results table when we were discussing which fields should be sortable. Would it be possible to make that one sortable too?
This adds a `sort` field to the evaluator results filterset. For the evaluator results endpoint in the API you should be able to sort, ascending (with just the sort field) or descending (prefixing the sort field with `-`), any of the listed fields (which are those available from `AccountActivity`). For example, the query arguments `?view=all&sort=-activity_date` would sort by activity date descending. To sort on multiple fields, they can be separated by comma, for example: `?view=all&sort=-activity_date,current_bal` will sort by activity date descending (newest first) and by current balance ascending (lowest first).
Co-authored-by: Betsy Lorton <schbetsy@users.noreply.github.com>
Member
Author
|
@virginiacc added |
virginiacc
approved these changes
Mar 30, 2026
virginiacc
left a comment
Contributor
There was a problem hiding this comment.
Works perfectly -- thanks, @willbarton!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a
sortfield to the evaluator results filterset. From the evaluator results endpoint in the API this should enable sorting, either ascending (with just the sort field) or descending (prefixing the sort field with-), on any of the listed fields (which are those available fromAccountActivity).This leverages the existing django-filters filter set by adding an [
OrderingFilterfield](https://django-filter.readthedocs.io/en/stable/ref/filters.html#django_filters.filters.OrderingFilterFor example, the query arguments
?view=all&sort=-activity_datewould sort by activity descending.To sort on multiple fields, they can be separated by comma, for example:
?view=all&sort=-activity_date,current_balwill sort by activity date descending (newest first) and by current balance ascending (lowest first).Once merged, I will add the following to the API wiki page's section on the evaluator results view:
If the
sortparameter is given the results will be sorted by the given field(s) either ascending (using the field name without decoration) or descending (prefixing the field name with-). Multiple fields can be sorted by comma-separating them. Fields the results can be sorted on are:activity_datecons_acct_numport_typeacct_typedate_opencredit_limithcolaid_numterms_durterms_freqsmpaactual_pmt_amtacct_statpmt_ratingphpphp1spc_com_cdcompl_cond_cdcurrent_balamt_past_dueorig_chg_off_amtdoaidofddate_closeddolpint_type_indaccount_holder__cons_info_indaccount_holder__ecoaaccount_holder__cons_info_ind_assocaccount_holder__ecoa_assock2__purch_sold_indk2__purch_sold_namek4__balloon_pmt_amtl1__change_indl1__new_id_numl1__new_acc_numFor example,
?view=all&sort=-activity_date,current_balwill sort by activity date descending (newest first) and by current balance ascending (lowest first).Checklist