diff --git a/AKModel/models.py b/AKModel/models.py index 2a80cef73c97600fc5f8c4013fda227bbf397c49..3a1c4bbae35c13d4c5fb91e1b3e8adc8d7bbe4b9 100644 --- a/AKModel/models.py +++ b/AKModel/models.py @@ -1,5 +1,7 @@ +import decimal import itertools import json +import math from dataclasses import dataclass from datetime import datetime, timedelta from typing import Iterable, Generator @@ -951,10 +953,12 @@ class AKSlot(models.Model): return [] return [f"availability-person-{owner.pk}"] + ceil_offet_eps = decimal.Decimal(1e-4) + # self.slots_in_an_hour is set in AKJSONExportView data = { "id": str(self.pk), - "duration": round(self.duration * self.slots_in_an_hour), + "duration": math.ceil(self.duration * self.slots_in_an_hour - ceil_offet_eps), "properties": {}, "room_constraints": [constraint.name for constraint in self.ak.requirements.all()], @@ -965,6 +969,7 @@ class AKSlot(models.Model): for owner in self.ak.owners.all()]), "description": self.ak.description, "reso": self.ak.reso, + "duration_in_hours": float(self.duration), }, }