Skip to content

Commit

Permalink
refactor: Limit applications_by_day loop to first 10 days in Dashboar…
Browse files Browse the repository at this point in the history
…dView

This commit modifies the DashboardView class in views.py to limit the loop over applications_by_day to the first 10 days. Previously, the loop iterated over all days, which could result in a large number of iterations and potentially impact performance. By limiting the loop to the first 10 days, the code improves efficiency and reduces unnecessary processing.
  • Loading branch information
QA2A committed Sep 11, 2024
1 parent 96cc644 commit 1177b35
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion website/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1641,7 +1641,7 @@ def get_context_data(self, **kwargs):

# Grouping data into the application_days list...
application_days_data = []
for day in applications_by_day:
for day in applications_by_day[:10]:
# Find matching emails sent for the day
email_day = next((email for email in emails_sent_by_day if email["truncated_date"] == day["date"]), None)
email_count = email_day["email_count"] if email_day else 0
Expand Down

0 comments on commit 1177b35

Please sign in to comment.