Skip to content

Commit

Permalink
refactor: Update email query in DashboardView to filter by applicatio…
Browse files Browse the repository at this point in the history
…n's user
  • Loading branch information
QA2A committed Sep 11, 2024
1 parent 7ff3a1a commit f8438e8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions website/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1627,7 +1627,7 @@ def get_context_data(self, **kwargs):

# Emails sent per day calculation...
emails_sent_by_day = Email.objects.filter(application__user=user).annotate(
date=TruncDay("created")
date_created=TruncDay("created")
).values("date").annotate(
email_count=Count("id")
).order_by("-date")
Expand All @@ -1643,7 +1643,7 @@ def get_context_data(self, **kwargs):
application_days_data = []
for day in applications_by_day:
# Find matching emails sent for the day
email_day = next((email for email in emails_sent_by_day if email["date"] == day["date"]), None)
email_day = next((email for email in emails_sent_by_day if email["date_created"] == day["date"]), None)
email_count = email_day["email_count"] if email_day else 0

# Find matching resume views for the day
Expand Down

0 comments on commit f8438e8

Please sign in to comment.