Bug 382162 - Wrong budget in root categories if subcategories also include subcategories
Summary: Wrong budget in root categories if subcategories also include subcategories
Status: RESOLVED FIXED
Alias: None
Product: skrooge
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: 25.1.0
Assignee: Stephane MANKOWSKI
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-07-09 15:46 UTC by Bernhard Scheirle
Modified: 2017-07-13 16:49 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Skrooge file that contains this bug. (419.02 KB, application/x-skgc)
2017-07-09 15:46 UTC, Bernhard Scheirle
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Bernhard Scheirle 2017-07-09 15:46:26 UTC
Created attachment 106519 [details]
Skrooge file that contains this bug.

Skrooge Version: 2.8.1

Lets say we have following setup:
* 6 Categories:
  * Root
  * Root > Sub
  * Root > Sub > Sub
  * Root2
  * Root2 > Sub2
  * Root2 > Sub2 > Sub2
* 4 Operations:
  * 10€ in "Root > Sub"
  *  5€ in "Root > Sub > Sub"
  * 10€ in "Root2 > Sub2"
  *  5€ in "Root2 > Sub2 > Sub2"
* 4 Budget entries:
  * "Root"         [including subcategories]
  * "Root > Sub"   [including subcategories]
  * "Root2"        [including subcategories]
  * "Root2 > Sub2" [NOT including subcategories]

Skrooge now shows following values for these budgets:

Budget         | Skrooge Value | Expected Value
---------------|---------------|---------------
"Root"         |           5 € |     0 €
"Root > Sub"   |          15 € |    15 €
"Root2"        |           5 € |     5 €
"Root2 > Sub2" |          10 € |    10 €
---------------|---------------|---------------
Total:         |          35 € |    30 €


As you can see skooge counts the 5€ in "Root > Sub > Sub" twice,
once in "Root" and once in "Root > Sub".
This leads to wrong budget values.

If multiple budgets in the same hierarchy have the "include subcategories" flag set only the closest parent should include operation of its subcategories.
E.g. The 5€ in "Root > Sub > Sub" should only be included in "Root > Sub".

The attached skrooge file contains this scenario.
Comment 1 Stephane MANKOWSKI 2017-07-13 16:49:10 UTC
Git commit 92039757fc60c6719c69caa133fd69d82a2d90e5 by Stephane Mankowski.
Committed on 13/07/2017 at 16:47.
Pushed by smankowski into branch 'master'.

Wrong budget in root categories if subcategories also include subcategories

M  +1    -0    CHANGELOG
M  +9    -8    skgbankmodeler/skgdocumentbank.cpp

https://commits.kde.org/skrooge/92039757fc60c6719c69caa133fd69d82a2d90e5