Commit 7afb4086 authored by Joren Vrancken's avatar Joren Vrancken Committed by Sébastiaan Versteeg
Browse files

Merge branch 'fix/registrations-renewal-start-date' into 'master'

Fix renewal since date calculation

See merge request !899

(cherry picked from commit 10e834bd)

dab9444f Set since date to previous until date of renewal registration
35846c87 Adjust tests of registrations to match
parent 99d6650e
"""The services defined by the registrations package""" """The services defined by the registrations package"""
import string import string
import unicodedata import unicodedata
from datetime import timedelta
from django.conf import settings from django.conf import settings
from django.contrib.auth import get_user_model from django.contrib.auth import get_user_model
...@@ -265,7 +264,7 @@ def _create_membership_from_entry(entry, member=None): ...@@ -265,7 +264,7 @@ def _create_membership_from_entry(entry, member=None):
if membership.until is None: if membership.until is None:
raise ValueError('This member already has a never ending ' raise ValueError('This member already has a never ending '
'membership') 'membership')
since = membership.until + timedelta(days=1) since = membership.until
except Renewal.DoesNotExist: except Renewal.DoesNotExist:
pass pass
until = timezone.datetime(year=lecture_year + 1, until = timezone.datetime(year=lecture_year + 1,
......
...@@ -403,7 +403,7 @@ class ServicesTest(TestCase): ...@@ -403,7 +403,7 @@ class ServicesTest(TestCase):
self.e3.length = Entry.MEMBERSHIP_YEAR self.e3.length = Entry.MEMBERSHIP_YEAR
membership3 = services._create_membership_from_entry(self.e3) membership3 = services._create_membership_from_entry(self.e3)
self.assertEqual(membership3.since, self.assertEqual(membership3.since,
existing_membership.until + timedelta(days=1)) existing_membership.until)
self.assertEqual(membership3.until, timezone.datetime( self.assertEqual(membership3.until, timezone.datetime(
year=2017, month=9, day=1).date()) year=2017, month=9, day=1).date())
self.assertEqual(membership3.user, self.e3.member) self.assertEqual(membership3.user, self.e3.member)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment