Add 4 people in the client list: Alex, Alice, Beth and Hans.
Enter a find query; in this case find n/Al which will return Alex and Alice
Enter a sort query (for example sort deadline descending).
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:
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".
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]
Steps to reproduce the bug
Add 4 people in the client list:
Alex
,Alice
,Beth
andHans
.Enter a
find
query; in this casefind n/Al
which will returnAlex
andAlice
Enter a
sort
query (for examplesort deadline descending
).Then exit the app, and reopen it.
Only
Alex
andAlice
will be listed;Beth
andHans
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 eachsort
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:find
query and may be labelled as a "feature flaw".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 previousfind
query. b. Or sort the entire list of clients, then pick only those who are in the current observable list to show [Easier, Recommended]