[0.5] move transactions doesn't work with more than 1 transaction

Bug #347066 reported by Michael Rooney
4
Affects Status Importance Assigned to Milestone
wxBanker
Fix Released
Undecided
Unassigned

Bug Description

Moving a single transaction seems to work fine, but moving more than one doesn't seem to work. It works on the model level and appears fine initially, but after a restart the transactions are actually back in the old account and not in the new one. The account balances are "correct" however as those are cached separately.

Revision history for this message
Michael Rooney (mrooney) wrote :

Karel, are you able to duplicate this? I wasn't able to notice what the cause of it was myself.

Revision history for this message
Michael Rooney (mrooney) wrote :

I committed a fix for this by just using the built-in Add and Remove transaction methods. Although now it requires a query per transaction, it is cleaner as it doesn't require changes to persistentstore. If you are able to identify the issue with the old method though, it may be better to use that and require only one query.

Changed in wxbanker:
milestone: none → 0.5
status: New → Fix Released
Revision history for this message
Karel Kolman (kolmis) wrote :

Michael I'm sorry for proposing merge of not fully tested code.

The problem was the IN sql keyword, i replaced one update with a sequence of updates.

I see you added a unittest for the move operation, but the model tests throw errors on my side. I think there should be a wx.lib.pubsub.Publisher().unsubAll() call either in testcase's setup() or tearDown methods() because of the way pub/sub methods are used, than the tests are failing, not throwing exceptions :)

As for the move op test, it currently fails with both my and your code
(Altered to use
 self.assertFalse(t1 in a.Transactions)
instead of
 self.assertFalse(t1 in a)

i'm not sure if you intend to make Account iterable as well
)

I'll make unittests next time i propose something to be merged.

Revision history for this message
Michael Rooney (mrooney) wrote : Re: [Bug 347066] Re: [0.5] move transactions doesn't work with more than 1 transaction

Ah thanks yes I did mean that in the test. It didn't even run on my
side due to a closed database error, which your unsubAll fixes, so I
will definitely do that, thanks! Though maybe accounts should be
iterable after all.

If the fix for the IN statement is to use multiple statements anyway
then I might just stick with doing it completely in the model as I am
now as it seems cleaner.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.