Skip to content

Commit

Permalink
misc: Add missing require in DailyUsages::FillHistoryService
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-pochet committed Nov 21, 2024
1 parent 2c97be8 commit 71fd6ab
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions app/services/daily_usages/fill_history_service.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# frozen_string_literal: true

require "timecop"

module DailyUsages
class FillHistoryService < BaseService
def initialize(subscription:, from_datetime:)
Expand Down
4 changes: 1 addition & 3 deletions lib/tasks/daily_usages.rake
Original file line number Diff line number Diff line change
@@ -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|
Expand All @@ -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|
Expand Down

0 comments on commit 71fd6ab

Please sign in to comment.