Skip to content

Commit

Permalink
chore: changed issue priority from NULL to none (#2142)
Browse files Browse the repository at this point in the history
* chore: changed issue priority from NULL to none

* fix: deleted the migration file
  • Loading branch information
NarayanBavisetti committed Sep 12, 2023
1 parent 6867154 commit 9bff10d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 27 deletions.
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

2 comments on commit 9bff10d

@vercel
Copy link

@vercel vercel bot commented on 9bff10d Sep 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

plane-dev – ./web/

plane-dev.vercel.app
plane-dev-plane.vercel.app
plane-dev-git-develop-plane.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 9bff10d Sep 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

plane-sh-dev – ./space/

plane-sh-dev-plane.vercel.app
plane-space-dev.vercel.app
plane-sh-dev-git-develop-plane.vercel.app

Please sign in to comment.