Skip to content
Snippets Groups Projects
Commit 9f0349fe authored by Simon Will's avatar Simon Will
Browse files

Also provide total count of feedback when querying feedback

parent 2bf62cc7
No related branches found
No related tags found
No related merge requests found
......@@ -79,6 +79,11 @@ def query_feedback():
fb_query = Feedback.query
if 'user_id' in filters:
fb_query = fb_query.filter_by(user_id=filters['user_id'])
total_count = Feedback.query.filter_by(
user_id=filters['user_id']).count()
else:
total_count = Feedback.query.count()
if 'limit' in filters or 'offset' in filters:
fb_query = fb_query.order_by(Feedback.id)
if 'limit' in filters:
......@@ -109,7 +114,12 @@ def query_feedback():
}
joined_feedback.append(joined)
return jsonify(joined_feedback)
data = {
'total_count': total_count,
'feedback': joined_feedback
}
return jsonify(data)
@current_app.route('/edit_feedback', methods=['POST'])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment