Skip to content
Snippets Groups Projects
Commit 34d48c2b authored by Piotr Gawron's avatar Piotr Gawron
Browse files

refactor on the variable names

parent ce47c0f3
No related branches found
No related tags found
1 merge request!41refactor on the variable names
Pipeline #
...@@ -5,6 +5,14 @@ from . import wrap_response ...@@ -5,6 +5,14 @@ from . import wrap_response
from ..forms import WorkerAddForm, WorkerEditForm, WorkerDetailForm from ..forms import WorkerAddForm, WorkerEditForm, WorkerDetailForm
from ..models import Worker, Availability from ..models import Worker, Availability
MONDAY_AS_DAY_OF_WEEK = 1
TUESDAY_AS_DAY_OF_WEEK = 2
WEDNESDAY_AS_DAY_OF_WEEK = 3
THURSDAY_AS_DAY_OF_WEEK = 4
FRIDAY_AS_DAY_OF_WEEK = 5
SATURDAY_AS_DAY_OF_WEEK = 6
SUNDAY_AS_DAY_OF_WEEK = 7
def doctors(request): def doctors(request):
doctors_list = Worker.objects.order_by('-last_name') doctors_list = Worker.objects.order_by('-last_name')
...@@ -47,24 +55,24 @@ def doctor_details(request, doctor_id): ...@@ -47,24 +55,24 @@ def doctor_details(request, doctor_id):
def doctor_availability(request, doctor_id): def doctor_availability(request, doctor_id):
avall = Availability.objects.filter(person=doctor_id) availabilities = Availability.objects.filter(person=doctor_id)
avmon = avall.filter(day_number=1) availability_on_monday = availabilities.filter(day_number=MONDAY_AS_DAY_OF_WEEK)
avtue = avall.filter(day_number=2) availability_on_tuesday = availabilities.filter(day_number=TUESDAY_AS_DAY_OF_WEEK)
avwed = avall.filter(day_number=3) availability_on_wednesday = availabilities.filter(day_number=WEDNESDAY_AS_DAY_OF_WEEK)
avthu = avall.filter(day_number=4) availability_on_thursday = availabilities.filter(day_number=THURSDAY_AS_DAY_OF_WEEK)
avfri = avall.filter(day_number=5) availability_on_friday = availabilities.filter(day_number=FRIDAY_AS_DAY_OF_WEEK)
avsat = avall.filter(day_number=6) availability_on_saturday = availabilities.filter(day_number=SATURDAY_AS_DAY_OF_WEEK)
avsun = avall.filter(day_number=7) availability_on_sunday = availabilities.filter(day_number=SUNDAY_AS_DAY_OF_WEEK)
context = { context = {
'avmon': avmon, 'avmon': availability_on_monday,
'avtue': avtue, 'avtue': availability_on_tuesday,
'avwed': avwed, 'avwed': availability_on_wednesday,
'avthu': avthu, 'avthu': availability_on_thursday,
'avfri': avfri, 'avfri': availability_on_friday,
'avsat': avsat, 'avsat': availability_on_saturday,
'avsun': avsun, 'avsun': availability_on_sunday,
'id': doctor_id 'id': doctor_id
} }
...@@ -72,7 +80,7 @@ def doctor_availability(request, doctor_id): ...@@ -72,7 +80,7 @@ def doctor_availability(request, doctor_id):
def doctor_availability_delete(request, doctor_id, availability_id): def doctor_availability_delete(request, doctor_id, availability_id):
availibility = Availability.objects.filter(id=availability_id) availability = Availability.objects.filter(id=availability_id)
if len(availibility) > 0: if len(availability) > 0:
availibility.delete() availability.delete()
return redirect(doctoravail, id=doctor_id) # FIXME doctoravail doesn't exist return redirect(doctor_availability, id=doctor_id)
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