fix(tasker): keep operational ordering and web build stable

This commit is contained in:
DCCONSTRUCTIONS 2026-05-10 19:59:34 +03:00
parent d55d182648
commit d7ef3ab050
2 changed files with 9 additions and 3 deletions

View File

@ -2,7 +2,7 @@
# SPDX-License-Identifier: AGPL-3.0-only
# 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
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_param = "priority_order" if order_by_param.startswith("-") else "-priority_order"
# 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"]:
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(
state_order=Case(
*[When(state__group=state_group, then=Value(i)) for i, state_group in enumerate(state_order)],

View File

@ -3,7 +3,7 @@ FROM node:22-alpine AS base
# Setup pnpm package manager with corepack and configure global bin directory for caching
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
ENV PATH="$PNPM_HOME:$PNPM_HOME/bin:$PATH"
RUN corepack enable
# *****************************************************************************