Skip to content
Snippets Groups Projects
Commit 96be4932 authored by Hangzhi Yu's avatar Hangzhi Yu
Browse files

Fix expand_start and expand_end functionality

parent 864ea4b5
No related branches found
No related tags found
1 merge request!5Resolve "Allow excluding amended events"
......@@ -58,7 +58,10 @@ class RecurrenceManager(CTEManager):
then=Func(
Func(
Cast("rrule", output_field=RruleField()),
F(self.datetime_start_field),
Case(
When(**{ f"{self.datetime_start_field}__lt": expand_start }, then=expand_start),
default=F(self.datetime_start_field)
) if expand_start else F(self.datetime_start_field),
min(expand_end, end) if expand_end else end,
function="get_occurrences",
output_field=DateTimeField(),
......@@ -84,7 +87,10 @@ class RecurrenceManager(CTEManager):
then=Func(
Func(
Cast("rrule", output_field=RruleField()),
F(self.date_start_field),
Case(
When(**{ f"{self.date_start_field}__lt": expand_start }, then=expand_start),
default=F(self.date_start_field)
) if expand_start else F(self.date_start_field),
min(expand_end, end) if expand_end else end,
function="get_occurrences",
output_field=DateTimeField(),
......
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