nus-cs2103-AY1718S1 / forum

Discussion Forum
5 stars 0 forks source link

Recent command: Displays a list of contacts user has searched for since app was opened #168

Open karrui opened 6 years ago

karrui commented 6 years ago

After a few hours of reading through how predicates work, here is my implementation!

Whenever a contact uses a FindCommand, the person found will be added into a FindHistory, similar to how CommandHistory works, and the resulting list is used to return the contacts recently searched for to the user using predicates.

The implementation is fairly robust, it

My PR can be found here Tests are fully implemented (hopefully).

A couple of design considerations - unlike HistoryCommand, the list shown to the user is as the order in list view, due to having to create a new list with the correct ordering and having to hook it to Model. It creates less complexity and less chances of regression. It could be a v2.0 enhancement though.

Anyways, enjoy!

~EDIT: Found a bug -- undo - redo - undo chain still deletes the Person from the FindHistory. It's too late in the night for my brain to work properly. If you have implemented things that tests undo-redo-undo chain and know how to fix it, please do inform me! I'll credit you :>~

Fixed as of https://github.com/CS2103AUG2017-F11-B3/main/pull/60/commits/0ff175ca8d94564825bf6fd50c0b9cc6a886bc29

Edit: Documentation is done as of https://github.com/CS2103AUG2017-F11-B3/main/pull/60/commits/610b0edc7cef99ce9755b862a930165f956aa2ff