Summary: | In credit account the "Online Balance" bar is red even when account and online balances are equal | ||
---|---|---|---|
Product: | [Applications] kmymoney | Reporter: | yzg <email200202> |
Component: | general | Assignee: | KMyMoney Devel Mailing List <kmymoney-devel> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version First Reported In: | 5.1.92 | ||
Target Milestone: | --- | ||
Platform: | Gentoo Packages | ||
OS: | Linux | ||
Latest Commit: | https://invent.kde.org/office/kmymoney/-/commit/1051093bb69629561c3bfc0ab167571ccc36020f | Version Fixed In: | 5.2 |
Sentry Crash Report: |
Description
yzg
2025-03-21 01:24:24 UTC
Suggested fix: --- onlinebalancedelegate.cpp 2025-03-21 19:55:20.508887229 +1100 +++ onlinebalancedelegate.cpp.new 2025-03-21 19:53:28.868843506 +1100 @@ -148,9 +148,10 @@ } const auto onlineBalanceValue = index.data(eMyMoney::Model::AccountOnlineBalanceValueRole).value<MyMoneyMoney>(); const auto accountId(index.data(eMyMoney::Model::IdRole).toString()); + const MyMoneyMoney showValuesInverted = index.data(eMyMoney::Model::ShowValueInvertedRole).toBool() ? MyMoneyMoney::MINUS_ONE : MyMoneyMoney::ONE; auto accountBalance(onlineBalanceValue); if (!accountId.isEmpty()) { - accountBalance = MyMoneyFile::instance()->balance(accountId, onlineBalanceDate); + accountBalance = MyMoneyFile::instance()->balance(accountId, onlineBalanceDate) * showValuesInverted; onlineBalanceValueTxt = onlineBalanceValue.formatMoney(index.data(eMyMoney::Model::AccountFractionRole).toInt()); } Well, the solution might work in your case but there are others where it might fail. The problem here is that we don't know how the institution reports the credit card account balance. My idea currently is - and I present that here for discussion - to compare the absolute values of those two balances. I think it is very unlikely that this will produce false positives (meaning the status will show as green when it is actually red). Thoughts? I think it will work. I'm not certain, but I think I may have actually seen this problem on occasion. I'll have to check my OFX for negative balance, but I do like the absolute value concept. A possibly relevant merge request was started @ https://invent.kde.org/office/kmymoney/-/merge_requests/267 Git commit 1051093bb69629561c3bfc0ab167571ccc36020f by Thomas Baumgart, on behalf of Thomas Baumgart. Committed on 31/03/2025 at 09:19. Pushed by tbaumgart into branch 'master'. If only sign of balance differs treat as OK If only the sign of the balance differs between the online received value and the one calculated by KMyMoney mark it as OK anyway. FIXED-IN: 5.2 M +2 -1 kmymoney/views/onlinebalancedelegate.cpp https://invent.kde.org/office/kmymoney/-/commit/1051093bb69629561c3bfc0ab167571ccc36020f |