diff --git a/Gemfile b/Gemfile index ecdfa973966..1918812c86f 100644 --- a/Gemfile +++ b/Gemfile @@ -40,6 +40,7 @@ gem "strong_migrations" gem "bigdecimal" gem "countries" gem "money-rails" +gem "timecop", require: false gem "tzinfo-data", platforms: %i[mingw mswin x64_mingw jruby] # GraphQL @@ -90,12 +91,11 @@ gem "valvat", require: false # Data Export gem "csv", "~> 3.0" -gem 'lago-expression', github: 'getlago/lago-expression', glob: 'expression-ruby/lago-expression.gemspec' +gem "lago-expression", github: "getlago/lago-expression", glob: "expression-ruby/lago-expression.gemspec" group :development, :test, :staging do gem "factory_bot_rails" gem "faker" - gem "timecop" end group :development, :test do 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|