avoid sorting by display_order

This commit is contained in:
jasquat 2022-08-29 10:44:04 -04:00
parent 299f715a2a
commit f000195786
5 changed files with 8 additions and 5 deletions

View File

@ -15,7 +15,9 @@ def main():
from spiffworkflow_backend.services.process_instance_service import (
ProcessInstanceService,
)
from spiffworkflow_backend.models.process_instance_report import ProcessInstanceReportModel
from spiffworkflow_backend.models.process_instance_report import (
ProcessInstanceReportModel,
)
process_model_identifier_ticket = "ticket"
db.session.query(ProcessInstanceModel).filter(

View File

@ -28,7 +28,7 @@ class ProcessGroup:
def __post_init__(self) -> None:
"""__post_init__."""
self.sort_index = f"{self.display_order}:{self.id}"
self.sort_index = self.id
def __eq__(self, other: Any) -> bool:
"""__eq__."""

View File

@ -45,7 +45,7 @@ class ProcessModelInfo:
def __post_init__(self) -> None:
"""__post_init__."""
self.sort_index = f"{self.display_order}:{self.process_group_id}:{self.id}"
self.sort_index = f"{self.process_group_id}:{self.id}"
def __eq__(self, other: Any) -> bool:
"""__eq__."""

View File

@ -92,7 +92,7 @@ def process_group_update(
def process_groups_list(page: int = 1, per_page: int = 100) -> flask.wrappers.Response:
"""Process_groups_list."""
process_groups = sorted(ProcessModelService().get_process_groups())
process_groups = ProcessModelService().get_process_groups()
batch = ProcessModelService().get_batch(
items=process_groups, page=page, per_page=per_page
)
@ -195,7 +195,7 @@ def process_model_list(
process_group_id: str, page: int = 1, per_page: int = 100
) -> flask.wrappers.Response:
"""Process model list!"""
process_models = sorted(ProcessModelService().get_process_models(process_group_id))
process_models = ProcessModelService().get_process_models(process_group_id)
batch = ProcessModelService().get_batch(
process_models, page=page, per_page=per_page
)

View File

@ -156,6 +156,7 @@ class ProcessModelService(FileSystemService):
process_models = []
for process_group in process_groups:
process_models.extend(process_group.process_models)
process_models.sort()
return process_models
def get_process_groups(self) -> list[ProcessGroup]: