Skip to content

Commit

Permalink
fix notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
Kenneth Kehl committed Nov 19, 2024
1 parent 0c9995d commit bb0a7c5
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions app/dao/notifications_dao.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,17 +298,19 @@ def get_notifications_for_service(
if client_reference is not None:
filters.append(Notification.client_reference == client_reference)

querie = Notification.query.filter(*filters)
querie = select(Notification).wnere(*filters)
querie = _filter_query(querie, filter_dict)
if personalisation:
querie = querie.options(joinedload(Notification.template))

return querie.order_by(desc(Notification.created_at)).paginate(
page=page,
per_page=page_size,
count=count_pages,
error_out=error_out,
)
querie = querie.order_by(desc(Notification.created_at))

results = db.session.execute(querie).all()
page_size = current_app.config["PAGE_SIZE"]
offset = (page - 1) * page_size
paginated_results = results[offset : offset + page_size]
pagination = Pagination(paginated_results, page, page_size, len(results))
return pagination


def _filter_query(querie, filter_dict=None):
Expand Down

0 comments on commit bb0a7c5

Please sign in to comment.