diff --git a/AKModel/models.py b/AKModel/models.py index d30912d3046b8ce4a874e775398cf7b6afbace81..57e488fe01c628c3f268f576e65d05f92cff88be 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 @@ -934,10 +936,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()], @@ -948,6 +952,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), }, }