AY2425S1-CS2103T-F14A-3 / tp

https://ay2425s1-cs2103t-f14a-3.github.io/tp/
MIT License
0 stars 5 forks source link

Sort query after find query deleted filtered-out values from addressbook #148

Closed Dinoman44 closed 2 weeks ago

Dinoman44 commented 2 weeks ago

Steps to reproduce the bug

  1. Add 4 people in the client list: Alex, Alice, Beth and Hans.

  2. Enter a find query; in this case find n/Al which will return Alex and Alice

  3. Enter a sort query (for example sort deadline descending).

  4. Then exit the app, and reopen it.

Only Alex and Alice will be listed; Beth and Hans have been removed completely.

Reason

After sorting the results of a find query, only the clients that matched the query will be sorted and these are the only clients saved to the JSON file (since it rewrites data to the JSON file upon each sort query.

Potential Fix

Make it such that the sort command, regardless of what queries came before, just sorts the entire list of clients and saves that. Then we have two options:

  1. After sorting, we can just show the entire list of users back to the client; this means they may have to repeat their find query and may be labelled as a "feature flaw".
  2. Sort the entire list of clients, but only show the ones that match the previous find query. There are a couple of ways this can also be done: a. Either sort the entire list of clients, and then essentially "re-run" the previous find query. b. Or sort the entire list of clients, then pick only those who are in the current observable list to show [Easier, Recommended]