Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: changed issue priority from NULL to none #2142

Merged
merged 3 commits into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions apiserver/plane/api/views/issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def list(self, request, slug, project_id):
filters = issue_filters(request.query_params, "GET")

# Custom ordering for priority and state
priority_order = ["urgent", "high", "medium", "low", None]
priority_order = ["urgent", "high", "medium", "low", "none"]
state_order = ["backlog", "unstarted", "started", "completed", "cancelled"]

order_by_param = request.GET.get("order_by", "-created_at")
Expand Down Expand Up @@ -331,7 +331,7 @@ def get(self, request, slug):
try:
filters = issue_filters(request.query_params, "GET")
# Custom ordering for priority and state
priority_order = ["urgent", "high", "medium", "low", None]
priority_order = ["urgent", "high", "medium", "low", "none"]
state_order = ["backlog", "unstarted", "started", "completed", "cancelled"]

order_by_param = request.GET.get("order_by", "-created_at")
Expand Down Expand Up @@ -1068,7 +1068,7 @@ def list(self, request, slug, project_id):
show_sub_issues = request.GET.get("show_sub_issues", "true")

# Custom ordering for priority and state
priority_order = ["urgent", "high", "medium", "low", None]
priority_order = ["urgent", "high", "medium", "low", "none"]
state_order = ["backlog", "unstarted", "started", "completed", "cancelled"]

order_by_param = request.GET.get("order_by", "-created_at")
Expand Down Expand Up @@ -2078,7 +2078,7 @@ def get(self, request, slug, project_id):
filters = issue_filters(request.query_params, "GET")

# Custom ordering for priority and state
priority_order = ["urgent", "high", "medium", "low", None]
priority_order = ["urgent", "high", "medium", "low", "none"]
state_order = ["backlog", "unstarted", "started", "completed", "cancelled"]

order_by_param = request.GET.get("order_by", "-created_at")
Expand Down
2 changes: 1 addition & 1 deletion apiserver/plane/api/views/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -1072,7 +1072,7 @@ def get(self, request, slug, user_id):
.order_by("state_group")
)

priority_order = ["urgent", "high", "medium", "low", None]
priority_order = ["urgent", "high", "medium", "low", "none"]

priority_distribution = (
Issue.issue_objects.filter(
Expand Down
4 changes: 2 additions & 2 deletions apiserver/plane/db/models/issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class Issue(ProjectBaseModel):
("high", "High"),
("medium", "Medium"),
("low", "Low"),
("none", "None")
)
parent = models.ForeignKey(
"self",
Expand All @@ -64,8 +65,7 @@ class Issue(ProjectBaseModel):
max_length=30,
choices=PRIORITY_CHOICES,
verbose_name="Issue Priority",
null=True,
blank=True,
default="none",
)
start_date = models.DateField(null=True, blank=True)
target_date = models.DateField(null=True, blank=True)
Expand Down
24 changes: 4 additions & 20 deletions apiserver/plane/utils/issue_filters.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.utils.timezone import make_aware
from django.utils.dateparse import parse_datetime


def filter_state(params, filter, method):
if method == "GET":
states = params.get("state").split(",")
Expand All @@ -23,7 +24,6 @@ def filter_state_group(params, filter, method):
return filter



def filter_estimate_point(params, filter, method):
if method == "GET":
estimate_points = params.get("estimate_point").split(",")
Expand All @@ -39,25 +39,10 @@ def filter_priority(params, filter, method):
if method == "GET":
priorities = params.get("priority").split(",")
if len(priorities) and "" not in priorities:
if len(priorities) == 1 and "null" in priorities:
filter["priority__isnull"] = True
elif len(priorities) > 1 and "null" in priorities:
filter["priority__isnull"] = True
filter["priority__in"] = [p for p in priorities if p != "null"]
else:
filter["priority__in"] = [p for p in priorities if p != "null"]

filter["priority__in"] = priorities
else:
if params.get("priority", None) and len(params.get("priority")):
priorities = params.get("priority")
if len(priorities) == 1 and "null" in priorities:
filter["priority__isnull"] = True
elif len(priorities) > 1 and "null" in priorities:
filter["priority__isnull"] = True
filter["priority__in"] = [p for p in priorities if p != "null"]
else:
filter["priority__in"] = [p for p in priorities if p != "null"]

filter["priority__in"] = params.get("priority")
return filter


Expand Down Expand Up @@ -229,7 +214,6 @@ def filter_issue_state_type(params, filter, method):
return filter



def filter_project(params, filter, method):
if method == "GET":
projects = params.get("project").split(",")
Expand Down Expand Up @@ -329,7 +313,7 @@ def issue_filters(query_params, method):
"module": filter_module,
"inbox_status": filter_inbox_status,
"sub_issue": filter_sub_issue_toggle,
"subscriber": filter_subscribed_issues,
"subscriber": filter_subscribed_issues,
"start_target_date": filter_start_target_date_issues,
}

Expand Down
Loading