Skip to content
Snippets Groups Projects
Commit d0230e76 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Merge branch '24-remove-legacy-timezone-handling' into 'master'

Resolve "Remove legacy timezone handling"

Closes #24

See merge request AlekSIS/onboarding/AlekSIS-App-Kolego!39
parents 151db84c 55a41e71
No related branches found
No related tags found
1 merge request!39Resolve "Remove legacy timezone handling"
Pipeline #192276 passed with warnings
from datetime import timezone
from typing import Iterable, Union
from django.conf import settings
from graphene_django.types import DjangoObjectType
from guardian.shortcuts import get_objects_for_user
from zoneinfo import ZoneInfo
from aleksis.core.schema.base import (
BaseBatchCreateMutation,
......@@ -89,22 +85,6 @@ class AbsenceBatchCreateMutation(BaseBatchCreateMutation):
optional_fields = ("comment", "reason")
permissions = ("kolego.create_absence_rule",)
@classmethod
def handle_datetime_start(cls, value, name, info) -> int:
value = value.replace(tzinfo=timezone.utc)
return value
@classmethod
def handle_datetime_end(cls, value, name, info) -> int:
value = value.replace(tzinfo=timezone.utc)
return value
@classmethod
def before_save(cls, root, info, input, obj): # noqa: A002
for absence in obj:
absence.timezone = ZoneInfo(settings.TIME_ZONE) # FIXME Use TZ provided by client
return obj
class AbsenceBatchDeleteMutation(BaseBatchDeleteMutation):
class Meta:
......@@ -127,22 +107,6 @@ class AbsenceBatchPatchMutation(BaseBatchPatchMutation):
)
permissions = ("kolego.edit_absence_rule",)
@classmethod
def handle_datetime_start(cls, value, name, info) -> int:
value = value.replace(tzinfo=timezone.utc)
return value
@classmethod
def handle_datetime_end(cls, value, name, info) -> int:
value = value.replace(tzinfo=timezone.utc)
return value
@classmethod
def before_save(cls, root, info, input, obj): # noqa: A002
for absence in obj:
absence.timezone = ZoneInfo(settings.TIME_ZONE) # FIXME Use TZ provided by client
return obj
class AbsenceReasonBatchCreateMutation(BaseBatchCreateMutation):
class Meta:
......
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