fix(tasker): keep operational ordering and web build stable
This commit is contained in:
parent
d55d182648
commit
d7ef3ab050
|
|
@ -2,7 +2,7 @@
|
||||||
# SPDX-License-Identifier: AGPL-3.0-only
|
# SPDX-License-Identifier: AGPL-3.0-only
|
||||||
# See the LICENSE file for details.
|
# See the LICENSE file for details.
|
||||||
|
|
||||||
from django.db.models import Case, CharField, Min, Value, When
|
from django.db.models import Case, CharField, F, Min, Value, When
|
||||||
|
|
||||||
# Custom ordering for priority and state
|
# Custom ordering for priority and state
|
||||||
PRIORITY_ORDER = ["urgent", "high", "medium", "low", "none"]
|
PRIORITY_ORDER = ["urgent", "high", "medium", "low", "none"]
|
||||||
|
|
@ -20,8 +20,14 @@ def order_issue_queryset(issue_queryset, order_by_param="-created_at"):
|
||||||
).order_by("priority_order", "-created_at")
|
).order_by("priority_order", "-created_at")
|
||||||
order_by_param = "priority_order" if order_by_param.startswith("-") else "-priority_order"
|
order_by_param = "priority_order" if order_by_param.startswith("-") else "-priority_order"
|
||||||
# State Ordering
|
# State Ordering
|
||||||
|
elif order_by_param in ["state__name", "-state__name"]:
|
||||||
|
issue_queryset = issue_queryset.annotate(state_sequence_order=F("state__sequence")).order_by(
|
||||||
|
"-state_sequence_order" if order_by_param.startswith("-") else "state_sequence_order",
|
||||||
|
"-created_at",
|
||||||
|
)
|
||||||
|
order_by_param = "-state_sequence_order" if order_by_param.startswith("-") else "state_sequence_order"
|
||||||
elif order_by_param in ["state__group", "-state__group"]:
|
elif order_by_param in ["state__group", "-state__group"]:
|
||||||
state_order = STATE_ORDER if order_by_param in ["state__name", "state__group"] else STATE_ORDER[::-1]
|
state_order = STATE_ORDER if order_by_param == "state__group" else STATE_ORDER[::-1]
|
||||||
issue_queryset = issue_queryset.annotate(
|
issue_queryset = issue_queryset.annotate(
|
||||||
state_order=Case(
|
state_order=Case(
|
||||||
*[When(state__group=state_group, then=Value(i)) for i, state_group in enumerate(state_order)],
|
*[When(state__group=state_group, then=Value(i)) for i, state_group in enumerate(state_order)],
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ FROM node:22-alpine AS base
|
||||||
|
|
||||||
# Setup pnpm package manager with corepack and configure global bin directory for caching
|
# Setup pnpm package manager with corepack and configure global bin directory for caching
|
||||||
ENV PNPM_HOME="/pnpm"
|
ENV PNPM_HOME="/pnpm"
|
||||||
ENV PATH="$PNPM_HOME:$PATH"
|
ENV PATH="$PNPM_HOME:$PNPM_HOME/bin:$PATH"
|
||||||
RUN corepack enable
|
RUN corepack enable
|
||||||
|
|
||||||
# *****************************************************************************
|
# *****************************************************************************
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue