Commit dd937a97 authored by Joost Rijneveld's avatar Joost Rijneveld
Browse files

Merge branch '297-fix-years-statistics' into 'master'

Fix years in statistics

Closes #297

See merge request !330
parents a2c793a2 e653498d
......@@ -13,6 +13,7 @@ from django.utils.translation import ugettext_lazy as _
from localflavor.generic.countries.sepa import IBAN_SEPA_COUNTRIES
from localflavor.generic.models import IBANField
from utils.snippets import datetime_to_lectureyear
from utils.validators import validate_file_extension
......@@ -440,7 +441,7 @@ def gen_stats_year(member_types):
students.
"""
stats_year = []
current_year = date.today().year
current_year = datetime_to_lectureyear(date.today())
for i in range(5):
new = dict()
......
......@@ -6,6 +6,7 @@ from django.utils import timezone
from members.models import (Member, Membership,
gen_stats_member_type, gen_stats_year)
from utils.snippets import datetime_to_lectureyear
class MemberBirthdayTest(TestCase):
......@@ -96,7 +97,7 @@ class StatisticsTest(TestCase):
Testing if active and non-active objects are counted correctly
"""
member_types = ["member", "supporter", "honorary"]
current_year = date.today().year
current_year = datetime_to_lectureyear(date.today())
# Set start date to current year - 1:
for m in Member.objects.all():
......@@ -160,7 +161,7 @@ class StatisticsTest(TestCase):
def test_gen_stats_different_years(self):
member_types = ["member", "supporter", "honorary"]
current_year = date.today().year
current_year = datetime_to_lectureyear(date.today())
# postgres does not define random access directly on unsorted querysets
members = [member for member in Member.objects.all()]
......
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