Skip to content

Commit

Permalink
filter out condition with no timesheet to avoid null date
Browse files Browse the repository at this point in the history
  • Loading branch information
digitalfox committed Oct 7, 2024
1 parent bf0371b commit fe3fa73
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions people/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,9 @@ def value_repr(self):
value=max_mission_per_month_qs["id__count"],
link=max_mission_per_month_link))

max_monthly_daily_rate = FinancialCondition.objects.filter(mission__lead__state="WON", consultant=consultant).annotate(
month=TruncMonth("mission__timesheet__working_date")).values("month").annotate(Avg("daily_rate")).order_by(
"-daily_rate__avg").first()
max_monthly_daily_rate = FinancialCondition.objects.filter(mission__lead__state="WON", consultant=consultant) \
.exclude(mission__timesheet__working_date=None).annotate(month=TruncMonth("mission__timesheet__working_date")) \
.values("month").annotate(Avg("daily_rate")).order_by("-daily_rate__avg").first()
if max_monthly_daily_rate:
achievements.append(Achievement(key="MAX_MONTHLY_DAILY_RATE",
name=_("Max monthly daily rate (%s)") % max_monthly_daily_rate["month"].strftime("%m/%Y"),
Expand Down

0 comments on commit fe3fa73

Please sign in to comment.