Skip to content

Commit

Permalink
fix project finances view
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiomagalhaes committed Dec 12, 2023
1 parent e93bdb7 commit 32e2c9c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions app/utils/analytics/finances/project_calculator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class ProjectCalculator
expected_cost
].freeze

def initialize(statement_of_work, start_date, end_date)
@statement_of_work = statement_of_work
def initialize(project, start_date, end_date)
@project = project
@start_date = start_date
@end_date = end_date
end
Expand Down Expand Up @@ -58,9 +58,9 @@ def data
private

def statements_of_work
return StatementOfWork.where(id: @statement_of_work.id) if @statement_of_work
statements = @project ? @project.statement_of_works : StatementOfWork.all

StatementOfWork.active_in_period(@start_date, @end_date)
statements.active_in_period(@start_date, @end_date)
end

def calculator(statement_of_work)
Expand Down
6 changes: 3 additions & 3 deletions app/utils/analytics/project_finances_analytics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

module Analytics
class ProjectFinancesAnalytics
def initialize(start_date, end_date, statement_of_work)
def initialize(start_date, end_date, project)
@start_date = start_date.to_datetime.beginning_of_day
@end_date = end_date.to_datetime.end_of_day
@statement_of_work = statement_of_work
@project = project
end

def data
Analytics::Finances::ProjectCalculator.new(@statement_of_work, @start_date, @end_date).data
Analytics::Finances::ProjectCalculator.new(@project, @start_date, @end_date).data
end
end
end

0 comments on commit 32e2c9c

Please sign in to comment.