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

flying team is passed as separate field from api (not a part of location name)

parent ca50c07b
No related branches found
No related tags found
1 merge request!111Resolve "Unfinished appointments"
...@@ -6,6 +6,7 @@ from django.http import JsonResponse ...@@ -6,6 +6,7 @@ from django.http import JsonResponse
from django.urls import reverse from django.urls import reverse
from django.utils import timezone from django.utils import timezone
from web.api_views.serialization_utils import serialize_datetime, location_to_str, flying_team_to_str
from web.models import Appointment from web.models import Appointment
from web.views.appointment import APPOINTMENT_LIST_GENERIC, APPOINTMENT_LIST_UNFINISHED, APPOINTMENT_LIST_APPROACHING from web.views.appointment import APPOINTMENT_LIST_GENERIC, APPOINTMENT_LIST_UNFINISHED, APPOINTMENT_LIST_APPROACHING
from web.views.notifications import get_filter_locations, \ from web.views.notifications import get_filter_locations, \
...@@ -95,17 +96,11 @@ def serialize_appointment(appointment): ...@@ -95,17 +96,11 @@ def serialize_appointment(appointment):
title = appointment.comment title = appointment.comment
appointment_type = ", ".join([appointment_type.code for appointment_type in appointment.appointment_types.all()]) appointment_type = ", ".join([appointment_type.code for appointment_type in appointment.appointment_types.all()])
time = "" time = serialize_datetime(appointment.datetime_when)
if appointment.datetime_when is not None: until = serialize_datetime(appointment.datetime_until())
time = appointment.datetime_when.strftime('%Y-%m-%d %H:%M')
until = "" location = location_to_str(appointment.location)
if appointment.datetime_when is not None: flying_team = flying_team_to_str(appointment.flying_team)
until = appointment.datetime_until().strftime('%Y-%m-%d %H:%M')
if appointment.flying_team is None:
location = unicode(appointment.location)
else:
location = unicode(appointment.location) + " (" + unicode(appointment.flying_team) + ")"
result = { result = {
"subject": subject_string, "subject": subject_string,
...@@ -121,6 +116,7 @@ def serialize_appointment(appointment): ...@@ -121,6 +116,7 @@ def serialize_appointment(appointment):
"color": appointment.color(), "color": appointment.color(),
"id": appointment.id, "id": appointment.id,
"location": location, "location": location,
"flying_team": flying_team,
"url": reverse('web.views.appointment_edit', kwargs={'id': str(appointment.id)}) "url": reverse('web.views.appointment_edit', kwargs={'id': str(appointment.id)})
} }
return result return result
...@@ -256,6 +256,7 @@ function get_calendar_events_function(source, allow_url_redirection, day_headers ...@@ -256,6 +256,7 @@ function get_calendar_events_function(source, allow_url_redirection, day_headers
color: entry.color, color: entry.color,
nd_number: entry.nd_number, nd_number: entry.nd_number,
location: entry.location, location: entry.location,
flying_team: entry.flying_team,
screening_number: entry.screening_number, screening_number: entry.screening_number,
phone_number: entry.phone_number, phone_number: entry.phone_number,
appointment_types: entry.appointment_types appointment_types: entry.appointment_types
......
...@@ -137,7 +137,11 @@ ...@@ -137,7 +137,11 @@
content += '<li>Appointment types: ' + event.appointment_types + '</li>' content += '<li>Appointment types: ' + event.appointment_types + '</li>'
} }
if (event.location) { if (event.location) {
content += '<li>Location: ' + event.location + '</li>' var location = event.location;
if (event.flying_team) {
location += " (" + event.flying_team + ")";
}
content += '<li>Location: ' + location + '</li>'
} }
content += "</ul>"; content += "</ul>";
$(element).popover({ $(element).popover({
......
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