Skip to content

Commit

Permalink
Update change bill day to check for default
Browse files Browse the repository at this point in the history
  • Loading branch information
abkruse committed Aug 11, 2017
1 parent 8e471aa commit c68a9f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion nadine/models/membership.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,9 @@ def set_to_package(self, package, start_date=None, end_date=None, paid_by=None,

# Save the package
if bill_day:
self.bill_day = bill_day
last_sub = ResourceSubscription.objects.filter(membership=self).order_by('end_date').last()
if last_sub and ((start_date - last_sub.end_date).days != 1) and settings.DEFAULT_BILLING_DAY == 0:
self.change_bill_day(bill_day)
self.save()

# Add subscriptions for each of the defaults
Expand Down
2 changes: 1 addition & 1 deletion nadine/tests/test_membership.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,7 +585,7 @@ def test_bill_day_for_long_absent_member(self):
self.assertTrue(membership.active_subscriptions().count() == 0)

# Set new membership package of PT5 starting today
membership.set_to_package(self.pt5Package, start_date=today)
membership.set_to_package(self.pt5Package, start_date=today, bill_day=today)
self.assertTrue(membership.active_subscriptions().count() == 1)

# Since there had been no active_subscriptions, bill day should be today.day
Expand Down

0 comments on commit c68a9f9

Please sign in to comment.