Skip to content

Commit

Permalink
Add rounded_hours_pr_day and rounded_hours_pr_day_normalized
Browse files Browse the repository at this point in the history
  • Loading branch information
xendk committed Aug 12, 2024
1 parent ae76ea3 commit 560e007
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/)
and this project adheres to [Semantic Versioning](https://semver.org/).


## 1.1.6 - [Unreleased]
## 1.2.0 - [Unreleased]

### Added
- Rounded versions of hours per day and same normalized.

## [1.1.5] - 2024-07-29

Expand Down
6 changes: 6 additions & 0 deletions src/responses/user_time_summary.cr
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ module Responses
@extra.billability.of_total_hours = @extra.billable_hours / @hours * 100

@extra.billability.hours_pr_day = @extra.billable_hours / work_days
@extra.billability.rounded_hours_pr_day = @extra.billable_rounded_hours / work_days

# Admin stuff.
@admin.billability.goal =
Expand All @@ -87,6 +88,7 @@ module Responses
if actual_work_days.positive?
# Actual amount of billable hours per day.
@extra.billability.hours_pr_day_normalized = @extra.billable_hours / actual_work_days
@extra.billability.rounded_hours_pr_day_normalized = @extra.billable_rounded_hours / actual_work_days
end

round
Expand Down Expand Up @@ -198,15 +200,19 @@ module Responses
property of_total_hours = 0_f64
property of_working_hours = 0_f64
property hours_pr_day = 0_f64
property rounded_hours_pr_day = 0_f64
property hours_pr_day_normalized = 0_f64
property rounded_hours_pr_day_normalized = 0_f64

def initialize() end

def round
@of_total_hours = @of_total_hours.round(2)
@of_working_hours = @of_working_hours.round(2)
@hours_pr_day = @hours_pr_day.round(2)
@rounded_hours_pr_day = @rounded_hours_pr_day.round(2)
@hours_pr_day_normalized = @hours_pr_day_normalized.round(2)
@rounded_hours_pr_day_normalized = @rounded_hours_pr_day_normalized.round(2)
end
end

Expand Down

0 comments on commit 560e007

Please sign in to comment.