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

appointments are spaned for duration time

parent 37170c76
No related branches found
No related tags found
1 merge request!1Appointments dev
......@@ -5,6 +5,7 @@ from django.utils import timezone
from django.contrib.auth.models import User, AnonymousUser
import datetime
from datetime import timedelta
def get_current_year():
return datetime.datetime.now().year
......@@ -440,6 +441,11 @@ class Appointment(models.Model):
visit = models.ForeignKey(Visit,
verbose_name='Visit ID'
)
comment = models.CharField(max_length=1024,
verbose_name='Comment',
null=True,
blank=True
)
datetime_when = models.DateTimeField(
verbose_name='Appointment on',
null=True, blank=True
......@@ -451,3 +457,15 @@ class Appointment(models.Model):
verbose_name='Has the appointment ended?',
default=False
)
def datetime_until(self):
if self.datetime_when is None:
return None
else:
return self.datetime_when + timedelta(minutes=max(self.length, 15))
def title(self):
if self.visit.subject.screening_number=="---":
return self.comment
else:
return self.visit.subject.first_name + " " + self.visit.subject.last_name
......@@ -137,8 +137,9 @@
events: [
{% for approach in approaching_list %}
{
title: '{{ approach.visit.subject.first_name }} {{ approach.visit.subject.last_name }}',
title: '{{ approach.title }}',
start: '{{ approach.datetime_when | date:"c" }}',
end: '{{ approach.datetime_until | date:"c" }}',
color: '#cfc600',
subject_id: '{{ approach.visit.subject.id }}',
id: '{{ approach.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