Skip to content

Commit

Permalink
Fixed categories counters in notes detail (fixes #938)
Browse files Browse the repository at this point in the history
  • Loading branch information
federicoiosue committed Oct 29, 2023
1 parent f5ef45e commit 33651d9
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1226,11 +1226,15 @@ private void moveCheckedItemsToBottom() {

private void categorizeNote() {
var currentCategory = noteTmp.getCategory() != null ? String.valueOf(noteTmp.getCategory().getId()) : null;
var originalCategory = noteOriginal.getCategory() != null ? String.valueOf(noteOriginal.getCategory().getId()) : null;
final var categories = Observable.from(DbHelper.getInstance().getCategories())
.map(category -> {
if (String.valueOf(category.getId()).equals(currentCategory)) {
if (String.valueOf(category.getId()).equals(currentCategory) && currentCategory != originalCategory) {
category.setCount(category.getCount() + 1);
}
if (String.valueOf(category.getId()).equals(originalCategory) && currentCategory != originalCategory) {
category.setCount(category.getCount() - 1);
}
return category;
}).toList().toBlocking().single();

Expand Down

0 comments on commit 33651d9

Please sign in to comment.