feat(navigation): add prominent validation quickstart action
This commit is contained in:
parent
0bbcaba211
commit
9c6b184e39
28614 changed files with 4356173 additions and 23 deletions
|
|
@ -7,7 +7,7 @@ from datetime import date, datetime
|
|||
from uuid import uuid4
|
||||
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from sqlalchemy import and_, or_, select
|
||||
from sqlalchemy import and_, func, or_, select
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from app.models.contact import Contact
|
||||
|
|
@ -224,9 +224,17 @@ class ValidationWorkflowService:
|
|||
statement = statement.order_by(sort_column.asc())
|
||||
else:
|
||||
statement = statement.order_by(sort_column.desc())
|
||||
total = len(list(self.session.scalars(count_statement)))
|
||||
total = self.session.scalar(
|
||||
select(func.count()).select_from(count_statement.order_by(None).subquery())
|
||||
) or 0
|
||||
items = list(self.session.scalars(statement.offset((page - 1) * page_size).limit(page_size)))
|
||||
return {"items": items, "total": total, "page": page, "page_size": page_size}
|
||||
return {
|
||||
"items": items,
|
||||
"total": total,
|
||||
"page": page,
|
||||
"page_size": page_size,
|
||||
"pages": max((total + page_size - 1) // page_size, 1),
|
||||
}
|
||||
|
||||
def revalidation_status(self, validation: Validation) -> str:
|
||||
if not validation.next_validation_on:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue