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

Fix expense and income lists to update automatically #168

Merged
merged 3 commits into from
Oct 24, 2020

Conversation

wltan
Copy link
Member

@wltan wltan commented Oct 24, 2020

Fixes #128

The root cause of #128 is that a new ObservableList is constructed every time getFilteredExpenseList or getFilteredIncomeList is called. This makes it so that the UI must be responsible for calling these methods to update itself. However, this goes against the philosophy of an ObservableList in the first place.

Instead, inside ModelManager we will maintain two ObservableLists of the correct type parameter (Expense and Income). Any call to getFilteredExpenseList or getFilteredIncomeList will return a wrapper around the same ObservableList every time, instead of constructing a new list.

When changes are made to the filtered expense or income lists, the corresponding internal ObservableLists will be refreshed with the latest values. This unfortunately needs to be done 'manually' within the ModelManager, but at least it is contained within the Model component and is not dependent on any other components.

Pitest: https://ay2021s1-cs2103t-w16-3.github.io/reports/pitest/202010241722/

@wltan wltan added type.bug 🐛 Something isn't working priority.medium 🥈 Todo for current iteration labels Oct 24, 2020
@wltan wltan added this to the v1.3 milestone Oct 24, 2020
@wltan wltan requested a review from a team October 24, 2020 09:32
wltan added a commit to AY2021S1-CS2103T-W16-3/reports that referenced this pull request Oct 24, 2020
@codecov-io
Copy link

codecov-io commented Oct 24, 2020

Codecov Report

Merging #168 into master will decrease coverage by 0.01%.
The diff coverage is 87.50%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #168      +/-   ##
============================================
- Coverage     74.76%   74.75%   -0.02%     
- Complexity      701      702       +1     
============================================
  Files           124      124              
  Lines          2128     2139      +11     
  Branches        226      227       +1     
============================================
+ Hits           1591     1599       +8     
  Misses          448      448              
- Partials         89       92       +3     
Impacted Files Coverage Δ Complexity Δ
...021s1_cs2103_w16_3/finesse/model/ModelManager.java 89.69% <87.50%> (-2.17%) 43.00 <5.00> (+1.00) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 402c809...070d8b2. Read the comment docs.

Copy link
Member

@ianyong ianyong left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link

@zhaojj2209 zhaojj2209 left a comment

Choose a reason for hiding this comment

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

LGTM!

@zhaojj2209 zhaojj2209 merged commit 87d169b into AY2021S1-CS2103T-W16-3:master Oct 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority.medium 🥈 Todo for current iteration type.bug 🐛 Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Filtered lists no longer update automatically
4 participants