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

Refractor refresh #218

Merged
merged 4 commits into from
Apr 6, 2023

Conversation

jerrrren
Copy link

Refactored refresh to be at ModelManager Level instead of SudoHR level.
Used predicate instead of delete/addition of employees to trigger view update

@@ -91,6 +98,16 @@ public void setSudoHrFilePath(Path sudoHrFilePath) {
userPrefs.setSudoHrFilePath(sudoHrFilePath);
}

@Override
public void refresh() {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just double confirm, setting predicate here to be true / false of an already filtered list will not introduce new unnecessary behaviour right? it wont remove all entires or display all entries right

@@ -190,8 +190,6 @@ public void addEmployee(Employee employee) {
public void setEmployee(Employee target, Employee editedEmployee) {
requireNonNull(editedEmployee);
employees.setEmployee(target, editedEmployee);
refreshDepartments();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

defensive prog aside, just wondering where's the logic for edit employee command? Where is the new refresh method called for edit employee command?
saw it removed here but no refresh() call to EditCommand? Or is it handled elsewhere

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be no need to add in logic for edit employee since we are currently just tracking the number of employees in each leaves/department, editing employee has no effect
Though for defensive programming sake, it would be better to refresh it

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh right. Normal edits to employee (eg name) will be updated because rendering logic handled diffly.

Copy link

@4ndrelim 4ndrelim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@4ndrelim 4ndrelim merged commit 249f456 into AY2223S2-CS2103T-T17-2:master Apr 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants