Merge branch 'feat/pagination' of github.com:makeplane/plane into feat/pagination

This commit is contained in:
rahulramesha 2024-03-22 13:58:54 +05:30
commit 3bacdd6dd4

View File

@ -1,6 +1,7 @@
import re import re
import uuid import uuid
from datetime import timedelta from datetime import timedelta
from django.utils import timezone from django.utils import timezone
# The date from pattern # The date from pattern
@ -63,24 +64,27 @@ def date_filter(filter, date_term, queries):
""" """
for query in queries: for query in queries:
date_query = query.split(";") date_query = query.split(";")
if len(date_query) >= 2: if date_query:
match = pattern.match(date_query[0]) if len(date_query) >= 2:
if match: match = pattern.match(date_query[0])
if len(date_query) == 3: if match:
digit, term = date_query[0].split("_") if len(date_query) == 3:
string_date_filter( digit, term = date_query[0].split("_")
filter=filter, string_date_filter(
duration=int(digit), filter=filter,
subsequent=date_query[1], duration=int(digit),
term=term, subsequent=date_query[1],
date_filter=date_term, term=term,
offset=date_query[2], date_filter=date_term,
) offset=date_query[2],
else: )
if "after" in date_query:
filter[f"{date_term}__gte"] = date_query[0]
else: else:
filter[f"{date_term}__lte"] = date_query[0] if "after" in date_query:
filter[f"{date_term}__gte"] = date_query[0]
else:
filter[f"{date_term}__lte"] = date_query[0]
else:
filter[f"{date_term}__contains"] = date_query[0]
def filter_state(params, filter, method): def filter_state(params, filter, method):