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
from django.urls import reverse
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.views.appointment import APPOINTMENT_LIST_GENERIC, APPOINTMENT_LIST_UNFINISHED, APPOINTMENT_LIST_APPROACHING
from web.views.notifications import get_filter_locations, \
......@@ -95,17 +96,11 @@ def serialize_appointment(appointment):
title = appointment.comment
appointment_type = ", ".join([appointment_type.code for appointment_type in appointment.appointment_types.all()])
time = ""
if appointment.datetime_when is not None:
time = appointment.datetime_when.strftime('%Y-%m-%d %H:%M')
until = ""
if appointment.datetime_when is not None:
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) + ")"
time = serialize_datetime(appointment.datetime_when)
until = serialize_datetime(appointment.datetime_until())
location = location_to_str(appointment.location)
flying_team = flying_team_to_str(appointment.flying_team)
result = {
"subject": subject_string,
......@@ -121,6 +116,7 @@ def serialize_appointment(appointment):
"color": appointment.color(),
"id": appointment.id,
"location": location,
"flying_team": flying_team,
"url": reverse('web.views.appointment_edit', kwargs={'id': str(appointment.id)})
}
return result
......@@ -256,6 +256,7 @@ function get_calendar_events_function(source, allow_url_redirection, day_headers
color: entry.color,
nd_number: entry.nd_number,
location: entry.location,
flying_team: entry.flying_team,
screening_number: entry.screening_number,
phone_number: entry.phone_number,
appointment_types: entry.appointment_types
......
......@@ -137,7 +137,11 @@
content += '<li>Appointment types: ' + event.appointment_types + '</li>'
}
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>";
$(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