Bug 238937 - Fix MyMoneySchedule::adjustedNextPayment so it behaves consistently
Summary: Fix MyMoneySchedule::adjustedNextPayment so it behaves consistently
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Fedora RPMs Linux
: NOR normal
Target Milestone: ---
Assignee: Ian Neal
URL:
Keywords:
Depends on: 237964
Blocks:
  Show dependency treegraph
 
Reported: 2010-05-26 22:56 UTC by Ian Neal
Modified: 2010-05-30 04:23 UTC (History)
1 user (show)

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


Attachments
Rewrite of adjustedNextPayment/nextPayment patch v0.1 (5.75 KB, patch)
2010-05-26 23:19 UTC, Ian Neal
Details
Port to KMM2 of rewrite of adjustedNextPayment/nextPayment patch v0.1 (8.39 KB, patch)
2010-05-29 12:35 UTC, Ian Neal
Details
Revised of adjustedNextPayment/nextPayment/nextPaymentDate patch v0.1 (6.90 KB, patch)
2010-05-30 04:12 UTC, Ian Neal
Details
Port to KMM2 of revised rewrite of adjustedNextPayment/nextPayment/nextPaymentDate patch v0.1 (9.91 KB, patch)
2010-05-30 04:20 UTC, Ian Neal
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ian Neal 2010-05-26 22:56:11 UTC
Version:           unspecified (using KDE 4.4.2) 
OS:                Linux

From comment 4 of bug 237964 (said by Alvaro Soliverez)
The problem lies in MyMoneySchedule, in the way nextPayment and
adjustedNextPayment work.
adjustedNextPayment only adjusts the calculation made by nextPayment, whereas
nextPayment should have within its logic how to adjust the date.
Otherwise, when it gets a date prior to current date, it simply returns the
current date, which is the logic thing to do.
nextPayment has to be modified to account for adjusted dates and behave
accordingly.


Reproducible: Always
Comment 1 Ian Neal 2010-05-26 23:19:04 UTC
Created attachment 43926 [details]
Rewrite of adjustedNextPayment/nextPayment patch v0.1

This patch:
* Splits out and rewrites main part of nextPayment into new method nextPaymentDate taking relevant next due date and the refDate;
* Changes adjustedNextPayment and nextPayment to use new method passing adjustedNextDueDate and nextDueDate respectively;

I've confirmed that all tests pass (including the new one).
Comment 2 Alvaro Soliverez 2010-05-27 05:02:35 UTC
Keep in mind that BUG:238583 may also be related to this somehow.
Comment 3 Ian Neal 2010-05-28 03:41:47 UTC
SVN commit 1131313 by iann:

BUG: 238937
Fix MyMoneySchedule::adjustedNextPayment so it behaves consistently
This patch:
* Splits out and rewrites main part of nextPayment into new method nextPaymentDate taking relevant next due date and the refDate;
* Changes adjustedNextPayment and nextPayment to use new method passing adjustedNextDueDate and nextDueDate respectively.

 M  +35 -24    mymoneyscheduled.cpp  
 M  +14 -0     mymoneyscheduled.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1131313
Comment 4 Ian Neal 2010-05-29 12:35:24 UTC
Created attachment 47451 [details]
Port to KMM2 of rewrite of adjustedNextPayment/nextPayment patch v0.1

This patch backports rewrite to KMM2 and also the test by Alvaro
Comment 5 Ian Neal 2010-05-30 01:54:13 UTC
Spotted an issue with certain scheduled transactions that are moved to the next processing day. Patch coming up.
Comment 6 Ian Neal 2010-05-30 04:12:04 UTC
Created attachment 47468 [details]
Revised of adjustedNextPayment/nextPayment/nextPaymentDate patch v0.1

This patch:
* Revises nextPaymentDate to be more like paymentDates having two variables, one for non-adjusted dates and the other for adjusted (if required) dates.
* Fixes call to mymoneyforecast to adjustedNextPayment to use an adjusted lastPayment date.
Comment 7 Ian Neal 2010-05-30 04:20:27 UTC
Created attachment 47469 [details]
Port to KMM2 of revised rewrite of adjustedNextPayment/nextPayment/nextPaymentDate patch v0.1

Port of combined patches for KMM4
Comment 8 Ian Neal 2010-05-30 04:23:40 UTC
SVN commit 1132176 by iann:

BUG: 238937
Fix MyMoneySchedule::adjustedNextPayment so it behaves consistently
This patch:
* Revises nextPaymentDate to be more like paymentDates having two variables, one for non-adjusted dates and the other for adjusted (if required) dates.
* Fixes call to mymoneyforecast to adjustedNextPayment to use an adjusted lastPayment date.

 M  +3 -1      mymoneyforecast.cpp  
 M  +27 -19    mymoneyscheduled.cpp  
 M  +4 -3      mymoneyscheduled.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1132176