From bffed3627d94b31dd23a4244953fea221843e921 Mon Sep 17 00:00:00 2001
From: Jonathan Weth <git@jonathanweth.de>
Date: Tue, 11 Jun 2024 21:56:55 +0200
Subject: [PATCH] Fix rules to use correct dates from Documentation calendar
 event

---
 aleksis/apps/alsijil/util/predicates.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/aleksis/apps/alsijil/util/predicates.py b/aleksis/apps/alsijil/util/predicates.py
index f3b5ad590..9f06195e2 100644
--- a/aleksis/apps/alsijil/util/predicates.py
+++ b/aleksis/apps/alsijil/util/predicates.py
@@ -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
-- 
GitLab