def handle(self, *args, **options):
     for i in range(options['amount']):
         if options['mode'] == 'totalrandom':
             rt = RecurringTransactionFactory()
         if options['mode'] == 'membership':
             rt = MembershipfeeFactory()
         if options['mode'] == 'keyholder':
             rt = KeyholderfeeFactory()
         print("Generated RecurringTransaction %s" % rt)
 def handle(self, *args, **options):
     today = datetime.datetime.now().date()
     tgt_tag = TransactionTag.objects.get(label='Membership fee', tmatch='1')
     for m in Member.objects.all():
         for rt in RecurringTransaction.objects.filter(owner=m, rtype=RecurringTransaction.YEARLY, tag=tgt_tag, end=None):
             scope_start, scope_end = rt.resolve_timescope(today)
             rt.end = scope_start.date() - datetime.timedelta(days=1)
             if rt.start > rt.end:
                 rt.start = rt.end - datetime.timedelta(days=1)
             rt.save()
         newrt = MembershipfeeFactory.create(amount=options["amount"], start=today, end=None, owner=m)
         print("Generated RecurringTransaction %s" % newrt)
Exemple #3
0
 def handle(self, *args, **options):
     cutoff_dt = dateutil.parser.parse(options['cutoffdate'])
     end_dt = cutoff_dt - datetime.timedelta(minutes=1)
     tgt_tag = TransactionTag.objects.get(label='Membership fee',
                                          tmatch='1')
     for rt in RecurringTransaction.objects.filter(
             rtype=RecurringTransaction.YEARLY,
             tag=tgt_tag,
             end=None,
             start__lt=cutoff_dt,
             amount=options['oldamount']):
         rt.end = end_dt
         rt.save()
         newrt = MembershipfeeFactory.create(amount=options['newamount'],
                                             start=cutoff_dt,
                                             end=None,
                                             owner=rt.owner)
         if options['verbosity'] > 0:
             print("Generated RecurringTransaction %s" % newrt)
 def handle(self, *args, **options):
     today = datetime.datetime.now().date()
     tgt_tag = TransactionTag.objects.get(label='Membership fee',
                                          tmatch='1')
     for m in Member.objects.all():
         for rt in RecurringTransaction.objects.filter(
                 owner=m,
                 rtype=RecurringTransaction.YEARLY,
                 tag=tgt_tag,
                 end=None):
             scope_start, scope_end = rt.resolve_timescope(today)
             rt.end = scope_start.date() - datetime.timedelta(days=1)
             if rt.start > rt.end:
                 rt.start = rt.end - datetime.timedelta(days=1)
             rt.save()
         newrt = MembershipfeeFactory.create(amount=options["amount"],
                                             start=today,
                                             end=None,
                                             owner=m)
         print("Generated RecurringTransaction %s" % newrt)
Exemple #5
0
def test_yearly_not_in_scope_notstarted():
    now = datetime.datetime.now()
    start, end = year_start_end(now+datetime.timedelta(weeks=60))
    t = MembershipfeeFactory(start=start, end=end)
    assert not t.in_timescope(now)
Exemple #6
0
def test_yearly_in_scope_without_end():
    now = datetime.datetime.now()
    start, end = year_start_end(now-datetime.timedelta(weeks=60))
    end = None
    t = MembershipfeeFactory(start=start, end=end)
    assert t.in_timescope(now)
Exemple #7
0
def test_yearly_in_scope_with_end():
    now = datetime.datetime.now()
    start, end = year_start_end(now)
    t = MembershipfeeFactory(start=start, end=end)
    assert t.in_timescope(now)
Exemple #8
0
def test_yearly_not_in_scope_notstarted():
    now = datetime.datetime.now()
    start, end = year_start_end(now + datetime.timedelta(weeks=60))
    t = MembershipfeeFactory(start=start, end=end)
    assert not t.in_timescope(now)
Exemple #9
0
def test_yearly_in_scope_without_end():
    now = datetime.datetime.now()
    start, end = year_start_end(now - datetime.timedelta(weeks=60))
    end = None
    t = MembershipfeeFactory(start=start, end=end)
    assert t.in_timescope(now)
Exemple #10
0
def test_yearly_in_scope_with_end():
    now = datetime.datetime.now()
    start, end = year_start_end(now)
    t = MembershipfeeFactory(start=start, end=end)
    assert t.in_timescope(now)