From 5980105bf7ff3b335a6c47a38700332c4c747db3 Mon Sep 17 00:00:00 2001 From: Vincent Pochet Date: Thu, 21 Nov 2024 16:32:52 +0100 Subject: [PATCH] misc: Add missing require in DailyUsages::FillHistoryService --- app/services/daily_usages/fill_history_service.rb | 2 ++ lib/tasks/daily_usages.rake | 4 +--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/services/daily_usages/fill_history_service.rb b/app/services/daily_usages/fill_history_service.rb index 9b1882038ef..63778df8e91 100644 --- a/app/services/daily_usages/fill_history_service.rb +++ b/app/services/daily_usages/fill_history_service.rb @@ -1,5 +1,7 @@ # frozen_string_literal: true +require "timecop" + module DailyUsages class FillHistoryService < BaseService def initialize(subscription:, from_datetime:) diff --git a/lib/tasks/daily_usages.rake b/lib/tasks/daily_usages.rake index b7bef5842ee..5ee4cab9da7 100644 --- a/lib/tasks/daily_usages.rake +++ b/lib/tasks/daily_usages.rake @@ -1,7 +1,5 @@ # frozen_string_literal: true -require 'timecop' - namespace :daily_usages do desc "Fill past daily usage" task :fill_history, [:organization_id, :days_ago] => :environment do |_task, args| @@ -15,7 +13,7 @@ namespace :daily_usages do subscriptions = organization.subscriptions .where(status: [:active, :terminated]) .where.not(started_at: nil) - .where('terminated_at IS NULL OR terminated_at >= ?', days_ago) + .where("terminated_at IS NULL OR terminated_at >= ?", days_ago) .includes(customer: :organization) subscriptions.find_each do |subscription|