Categorize reports' data according to report types
ClosedPublic

Authored by wojnilowicz on Apr 16 2017, 1:13 PM.

Details

Summary

Read and write only that what's necessary in MyMoneyReport::read and
MyMoneyReport::write.

Diff Detail

Repository
R261 KMyMoney
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
wojnilowicz created this revision.Apr 16 2017, 1:13 PM

Is this change backward compatible or better version transparent, i.e. can version 4.8 still read that format and can 5.0 still read the data written by 4.8?

kmymoney/mymoney/mymoneyreport.cpp
657

delete this line

664

change this to

int i = datelockstr.toUInt(&ok);

Is this change backward compatible or better version transparent, i.e. can version 4.8 still read that format and can 5.0 still read the data written by 4.8?

I believe yes, because it reads and writes only necessary data and 4.8 writes and reads all data. I assume that if 4.8 tries to load any unnecessary data, that 5.0 didn't write, nothing bad will happen. Nevertheless I wouldn't recommend returning to 4.8 once 5.0 saved an report.

I believe yes, because it reads and writes only necessary data and 4.8 writes and reads all data. I assume that if 4.8 tries to load any unnecessary data, that 5.0 didn't write, nothing bad will happen. Nevertheless I wouldn't recommend returning to 4.8 once 5.0 saved an report.

Well, there is a comment at the beginning of MyMoneyReport::read(const QDomElement& e) which is left unchanged:

// The goal of this reading method is 100% backward AND 100% forward
// compatibility.  Any report ever created with any version of KMyMoney
// should be able to be loaded by this method (as long as it's one of the
// report types supported in this version, of course)

So we shall make sure that this still is the case. There might be other changes in 5.0 which do not allow to go back to 4.8, but we need to make sure the user knows about it. Believing is probably not good enough at this point. Double checking would be very much appreciated.

I believe yes, because it reads and writes only necessary data and 4.8 writes and reads all data. I assume that if 4.8 tries to load any unnecessary data, that 5.0 didn't write, nothing bad will happen. Nevertheless I wouldn't recommend returning to 4.8 once 5.0 saved an report.

Well, there is a comment at the beginning of MyMoneyReport::read(const QDomElement& e) which is left unchanged:

// The goal of this reading method is 100% backward AND 100% forward
// compatibility.  Any report ever created with any version of KMyMoney
// should be able to be loaded by this method (as long as it's one of the
// report types supported in this version, of course)

So we shall make sure that this still is the case. There might be other changes in 5.0 which do not allow to go back to 4.8, but we need to make sure the user knows about it. Believing is probably not good enough at this point. Double checking would be very much appreciated.

I analyzed the code and it's all about reading. If 4.8 tries to read something 5.0 didn't write, it will assign default parameter, which we don't care for, because it isn't necessary in this report.
In my opinion reports will be correctly read in 4.8 and 5.0 regardless of version in which they were saved.

tbaumgart accepted this revision as: tbaumgart.Apr 17 2017, 12:34 PM

I think that is good enough and matches my (code reading) findings. I am all for simplification.

This revision is now accepted and ready to land.Apr 17 2017, 12:34 PM
This revision was automatically updated to reflect the committed changes.