Skip to content
Snippets Groups Projects
Commit adf07a27 authored by Carlos Vega's avatar Carlos Vega
Browse files

fixed issue with visit numbers in statistics...

fixed issue with visit numbers in statistics https://git-r3lab.uni.lu/NCER-PD/scheduling-system/-/issues/333\#note_46157
parent 1fbcc5ce
No related branches found
No related tags found
1 merge request!250Virus visit column changes
...@@ -7,8 +7,10 @@ from django.utils.dates import MONTHS ...@@ -7,8 +7,10 @@ from django.utils.dates import MONTHS
from web.models import Appointment, AppointmentType, AppointmentTypeLink, \ from web.models import Appointment, AppointmentType, AppointmentTypeLink, \
Availability, ContactAttempt, FlyingTeam, Holiday, Item, \ Availability, ContactAttempt, FlyingTeam, Holiday, Item, \
StudySubject, Room, Worker, Visit, VoucherType, VoucherTypePrice StudySubject, Room, Worker, Visit, VoucherType, VoucherTypePrice, ConfigurationItem
from web.models.constants import SUBJECT_TYPE_CHOICES from web.models.constants import SUBJECT_TYPE_CHOICES, VISIT_SHOW_VISIT_NUMBER_FROM_ZERO
from distutils.util import strtobool
from web.templatetags.filters import display_visit_number
""" """
Possible redundancy, but if need arises, contents of forms can be easily customized Possible redundancy, but if need arises, contents of forms can be easily customized
...@@ -127,6 +129,16 @@ class StatisticsForm(Form): ...@@ -127,6 +129,16 @@ class StatisticsForm(Form):
choices = [(-1, "all")] choices = [(-1, "all")]
choices.extend(SUBJECT_TYPE_CHOICES.items()) choices.extend(SUBJECT_TYPE_CHOICES.items())
self.fields['subject_type'] = forms.ChoiceField(choices=choices, initial="-1") self.fields['subject_type'] = forms.ChoiceField(choices=choices, initial="-1")
visit_from_zero = ConfigurationItem.objects.get(type=VISIT_SHOW_VISIT_NUMBER_FROM_ZERO).value
#True values are y, yes, t, true, on and 1; false values are n, no, f, false, off and 0.
if strtobool(visit_from_zero):
new_choices = []
for value, label in visit_choices:
if int(value) > 0:
label = display_visit_number(label)
new_choices.append((value, label))
visit_choices = new_choices
self.fields['visit'] = forms.ChoiceField(choices=visit_choices, initial="-1") self.fields['visit'] = forms.ChoiceField(choices=visit_choices, initial="-1")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment