Skip to content

Commit

Permalink
Returns incident types ordered by name and severities and priorities …
Browse files Browse the repository at this point in the history
…ordered by viewing order (#2750)

* Returns incident types ordered by name

* Returns incident severities ordered by view order

* Returns incident priorities ordered by view order
  • Loading branch information
mvilanova authored Dec 7, 2022
1 parent 0d253c6 commit bf2824c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/dispatch/incident/priority/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,13 @@ def get_all_enabled(*, db_session, project_id: int = None) -> List[Optional[Inci
db_session.query(IncidentPriority)
.filter(IncidentPriority.project_id == project_id)
.filter(IncidentPriority.enabled == true())
.order_by(IncidentPriority.view_order)
)
return db_session.query(IncidentPriority).filter(IncidentPriority.enabled == true())
return (
db_session.query(IncidentPriority)
.filter(IncidentPriority.enabled == true())
.order_by(IncidentPriority.view_order)
)


def create(*, db_session, incident_priority_in: IncidentPriorityCreate) -> IncidentPriority:
Expand Down
7 changes: 6 additions & 1 deletion src/dispatch/incident/severity/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,14 @@ def get_all_enabled(*, db_session, project_id: int = None) -> List[Optional[Inci
db_session.query(IncidentSeverity)
.filter(IncidentSeverity.project_id == project_id)
.filter(IncidentSeverity.enabled == true())
.order_by(IncidentSeverity.view_order)
)

return db_session.query(IncidentSeverity).filter(IncidentSeverity.enabled == true())
return (
db_session.query(IncidentSeverity)
.filter(IncidentSeverity.enabled == true())
.order_by(IncidentSeverity.view_order)
)


def create(*, db_session, incident_severity_in: IncidentSeverityCreate) -> IncidentSeverity:
Expand Down
7 changes: 6 additions & 1 deletion src/dispatch/incident/type/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,13 @@ def get_all_enabled(*, db_session, project_id: int = None) -> List[Optional[Inci
db_session.query(IncidentType)
.filter(IncidentType.project_id == project_id)
.filter(IncidentType.enabled == true())
.order_by(IncidentType.name)
)
return db_session.query(IncidentType).filter(IncidentType.enabled == true())
return (
db_session.query(IncidentType)
.filter(IncidentType.enabled == true())
.order_by(IncidentType.name)
)


def create(*, db_session, incident_type_in: IncidentTypeCreate) -> IncidentType:
Expand Down

0 comments on commit bf2824c

Please sign in to comment.