Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions kulkunen/drivers/securitas.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import jsonschema
import requests
from datetime import timedelta
from django.core.exceptions import ValidationError
from django.utils import timezone
from jsonschema.exceptions import ValidationError as JsonSchemaValidationError
Expand Down Expand Up @@ -119,11 +118,8 @@ def remove_grant(self, grant):
)

def prepare_install_grant(self, grant):
# Because of a bug in SiPass API, the changes are not synchronized
# to the building units automatically. We install the grants one day
# before their start time and schedule a re-install of the units
# every nightly.
grant.install_at = grant.starts_at - timedelta(days=1)
# Securitas grants can be installed immediately
grant.install_at = timezone.now()
grant.save(update_fields=["install_at"])

def get_system_config_schema(self):
Expand Down