From af077327f1edb7baee3a5879033e9732ea49790d Mon Sep 17 00:00:00 2001 From: Kaio Magalhaes Date: Wed, 3 Jul 2024 16:37:16 -0300 Subject: [PATCH] fix time entries order --- app/controllers/analytics/time_entries_controller.rb | 1 - app/utils/analytics/time_entries_analytics.rb | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/controllers/analytics/time_entries_controller.rb b/app/controllers/analytics/time_entries_controller.rb index b5199cc..7ad1468 100644 --- a/app/controllers/analytics/time_entries_controller.rb +++ b/app/controllers/analytics/time_entries_controller.rb @@ -8,7 +8,6 @@ class TimeEntriesController < ApplicationController def index @time_entries = Analytics::TimeEntriesAnalytics.new(@project, @statement_of_work, params[:start_date], params[:end_date]).data - render json: @time_entries end diff --git a/app/utils/analytics/time_entries_analytics.rb b/app/utils/analytics/time_entries_analytics.rb index aacc8d6..65737d5 100644 --- a/app/utils/analytics/time_entries_analytics.rb +++ b/app/utils/analytics/time_entries_analytics.rb @@ -82,11 +82,11 @@ def assignments def requirements return @requirements if @requirements - @requirements = if @project + @requirements = if @statement_of_work + Requirement.where(id: @statement_of_work.requirements.map(&:id)) + elsif @project Requirement.where(id: @project.statement_of_works.map(&:requirements) .flatten.map(&:id)) - elsif @statement_of_work - Requirement.where(id: @statement_of_work.requirements.map(&:id)) else Requirement.all end