Code Duplication    Length = 15-16 lines in 2 locations

chezbetty/models/transaction.py 2 locations

@@ 389-404 (lines=16) @@
386
account.Account.transactions = __transactions
387
388
# This is in a stupid place due to circular input problems
389
@limitable_all
390
def __get_events(self):
391
    return object_session(self).query(event.Event)\
392
            .join(Transaction)\
393
            .filter(or_(
394
                      or_(
395
                        Transaction.to_account_virt_id == self.id,
396
                        Transaction.fr_account_virt_id == self.id,
397
                        Transaction.to_account_cash_id == self.id,
398
                        Transaction.fr_account_cash_id == self.id),
399
                      and_(
400
                        or_(event.Event.type == "purchase",
401
                            event.Event.type == "deposit"),
402
                        event.Event.user_id == self.id)))\
403
            .filter(event.Event.deleted==False)\
404
            .order_by(desc(event.Event.timestamp))
405
406
@property
407
def __events(self):
@@ 360-374 (lines=15) @@
357
        return days
358
359
360
def __get_transactions_query(self):
361
    return object_session(self).query(Transaction)\
362
            .join(event.Event)\
363
            .filter(or_(
364
                      or_(
365
                        Transaction.to_account_virt_id == self.id,
366
                        Transaction.fr_account_virt_id == self.id,
367
                        Transaction.to_account_cash_id == self.id,
368
                        Transaction.fr_account_cash_id == self.id),
369
                      and_(
370
                        or_(event.Event.type == "purchase",
371
                            event.Event.type == "deposit"),
372
                        event.Event.user_id == self.id)))\
373
            .filter(event.Event.deleted==False)\
374
            .order_by(desc(event.Event.timestamp))\
375
376
@limitable_all
377
def __get_transactions(self):