Skip to content

Commit

Permalink
fix time entries analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiomagalhaes committed Mar 21, 2024
1 parent 5b51525 commit 2e697fe
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/utils/analytics/time_entries/expected_hours.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ def data
end

def entries
days = ([@start_date, @assignment.start_date].max..[@end_date, @assignment.end_date].min).filter do |d|
!d.sunday? && !d.saturday?
start_date = [@start_date, @assignment.start_date].max
end_date = [@end_date, @assignment.end_date].min

# Convert the range into an array of dates
days = (start_date.to_date..end_date.to_date).to_a.select do |d|
d.wday.between?(1, 5) # Exclude Saturday (6) and Sunday (0)
end

days.map do |day|
Expand Down

0 comments on commit 2e697fe

Please sign in to comment.