Skip to content

Commit

Permalink
feat(data): Set usage_date when filling daily usage history
Browse files Browse the repository at this point in the history
  • Loading branch information
rsempe committed Dec 19, 2024
1 parent 8a862a2 commit 1d3434d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/services/daily_usages/fill_history_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ def call
datetime = date.in_time_zone(subscription.customer.applicable_timezone).beginning_of_day.utc

next if date == Time.zone.today ||
subscription.daily_usages.where(usage_date: date - 1.day).exists? ||
DailyUsage.refreshed_at_in_timezone(datetime).where(subscription_id: subscription.id).exists?

Timecop.thread_safe = true
Expand All @@ -44,7 +45,8 @@ def call
from_datetime: usage.from_datetime,
to_datetime: usage.to_datetime,
refreshed_at: datetime,
usage_diff: {}
usage_diff: {},
usage_date: date - 1.day
)

if date != from
Expand Down

0 comments on commit 1d3434d

Please sign in to comment.