Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maintaining Sort order when adding or editing contacts #213

Prev Previous commit
Improve method naming clarity
AbdulrahmanAlRammah committed Nov 7, 2024
commit 762e7e3d0c480735a1b57fab6ea25cd310bf6afd
8 changes: 4 additions & 4 deletions src/main/java/seedu/address/model/ModelManager.java
Original file line number Diff line number Diff line change
@@ -23,7 +23,7 @@
public class ModelManager implements Model {
private static final Logger logger = LogsCenter.getLogger(ModelManager.class);
private static final String RESORT_ERROR = "Error: User Prefs had an invalid sort parameter. "
+ "Resorting after changes were made to the addressbook was abandoned.";
+ "Re-sorting after changes were made to the addressbook was abandoned.";

private final AddressBook addressBook;
private final UserPrefs userPrefs;
@@ -118,15 +118,15 @@ public void deletePerson(Person target) {
@Override
public void addPerson(Person person) {
addressBook.addPerson(person);
resortPersonList(getSortSettings());
reSortPersonList(getSortSettings());
updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS);
}

@Override
public void setPerson(Person target, Person editedPerson) {
requireAllNonNull(target, editedPerson);
addressBook.setPerson(target, editedPerson);
resortPersonList(getSortSettings());
reSortPersonList(getSortSettings());
}

//=========== Filtered Person List Accessors =============================================================
@@ -169,7 +169,7 @@ public void sortPersonList(String parameter, boolean isAscending) throws Command
setSortSettings(new SortSettings(parameter, isAscending));
}

private void resortPersonList(SortSettings sortSettings) {
private void reSortPersonList(SortSettings sortSettings) {
String parameter = sortSettings.getSortParameter();
boolean isAscending = sortSettings.isAscendingOrder();
try {