Description
Several pages fetch and display all records without any pagination. As the application grows with real usage, these pages will become slow and unusable with large datasets.
Affected Pages
- Admin Dashboard - Lists all users (could be hundreds/thousands)
- List Responses - Lists all quiz attempts across students/classes
- Teacher Dashboard - Lists quizzes, classes, and attempts
- Student Dashboard - Lists available quizzes
- Leaderboard - Lists rankings per class
- Pending Enrollments - Lists enrollment requests
Current Behavior
# All records fetched at once - no LIMIT/OFFSET
cur.execute("SELECT * FROM users")
users = cur.fetchall() # Could be thousands of rows
Impact
- Performance degradation as data grows
- Page load time increases linearly with data size
- Memory pressure on the server from large result sets
- Poor UX - users must scroll through endless lists
Recommended Enhancement
-
Add pagination parameters to database queries:
page = request.args.get('page', 1, type=int)
per_page = 20
offset = (page - 1) * per_page
cur.execute("SELECT * FROM users ORDER BY name LIMIT %s OFFSET %s", (per_page, offset))
users = cur.fetchall()
-
Add pagination UI component to templates (previous/next buttons, page numbers)
-
Show total record count and current page info:
<div class="pagination">
<span>Page {{ page }} of {{ total_pages }}</span>
{% if page > 1 %}<a href="?page={{ page-1 }}">Previous</a>{% endif %}
{% if page < total_pages %}<a href="?page={{ page+1 }}">Next</a>{% endif %}
</div>
Description
Several pages fetch and display all records without any pagination. As the application grows with real usage, these pages will become slow and unusable with large datasets.
Affected Pages
Current Behavior
Impact
Recommended Enhancement
Add pagination parameters to database queries:
Add pagination UI component to templates (previous/next buttons, page numbers)
Show total record count and current page info: