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

Fix rules to use correct dates from Documentation calendar event

parent d9e3d6db
No related branches found
No related tags found
1 merge request!360Resolve "Add absence management to course book student dialog"
Pipeline #189577 failed
......@@ -2,7 +2,7 @@ from typing import Any, Union
from django.contrib.auth.models import User
from django.db.models import Q
from django.utils.timezone import localdate, localtime
from django.utils.timezone import localdate, now
from rules import predicate
......@@ -481,11 +481,11 @@ def is_in_allowed_time_range(user: User, obj: Documentation):
get_site_preferences()["alsijil__allow_edit_future_documentations"] == "all"
or (
get_site_preferences()["alsijil__allow_edit_future_documentations"] == "current_day"
and obj.datetime_start.date() <= localdate()
and obj.value_start_datetime(obj).date() <= localdate()
)
or (
get_site_preferences()["alsijil__allow_edit_future_documentations"] == "current_time"
and obj.datetime_start <= localtime()
and obj.value_start_datetime(obj) <= now()
)
):
return True
......@@ -495,6 +495,6 @@ def is_in_allowed_time_range(user: User, obj: Documentation):
@predicate
def is_in_allowed_time_range_for_participation_status(user: User, obj: Documentation):
"""Predicate which checks if the documentation is in the allowed time range for editing."""
if obj and obj.datetime_start <= localtime():
if obj and obj.value_start_datetime(obj) <= now():
return True
return False
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