Skip to content

Commit

Permalink
fix: fix mes discussions uniquement" toggle on home discussions table (
Browse files Browse the repository at this point in the history
  • Loading branch information
edelclaux authored Dec 13, 2024
1 parent 30c2726 commit 996903b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
12 changes: 5 additions & 7 deletions backend/geonature/core/gn_synthese/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -1496,8 +1496,8 @@ def list_all_reports(permissions):
type_name = request.args.get("type")
orderby = request.args.get("orderby", "creation_date")
sort = request.args.get("sort")
page = int(request.args.get("page", 1))
per_page = int(request.args.get("per_page", 10))
page = request.args.get("page", 1, int)
per_page = request.args.get("per_page", 10, int)
my_reports = request.args.get("my_reports", "false").lower() == "true"

# Start query
Expand Down Expand Up @@ -1599,11 +1599,9 @@ def list_all_reports(permissions):
result.append(report_dict)

response = {
"total_filtered": paginated_results.total,
"total": total,
"pages": paginated_results.pages,
"current_page": page,
"per_page": per_page,
"total": paginated_results.total,
"page": paginated_results.page,
"per_page": paginated_results.per_page,
"items": result,
}
return jsonify(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export class HomeDiscussionsTableComponent implements OnInit, OnDestroy {
_myReportsOnly: boolean;
@Input()
set myReportsOnly(value: boolean) {
this.pagination = this.DEFAULT_PAGINATION;
this._myReportsOnly = value;
this._fetchDiscussions();
}
Expand Down Expand Up @@ -120,7 +121,7 @@ export class HomeDiscussionsTableComponent implements OnInit, OnDestroy {
this.discussions = this._transformDiscussions(data.items);
this.pagination = {
totalItems: data.total,
currentPage: data.current_page,
currentPage: data.page,
perPage: data.per_page,
};
}
Expand Down

0 comments on commit 996903b

Please sign in to comment.