From 560e0072ebdf9e40c56ea30816b020fe5c5a3d57 Mon Sep 17 00:00:00 2001 From: Thomas Fini Hansen Date: Mon, 12 Aug 2024 11:10:52 +0200 Subject: [PATCH] Add rounded_hours_pr_day and rounded_hours_pr_day_normalized --- CHANGELOG.md | 5 ++++- src/responses/user_time_summary.cr | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ccfdebb..2c8ed3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/responses/user_time_summary.cr b/src/responses/user_time_summary.cr index 4b858fd..bda12ee 100644 --- a/src/responses/user_time_summary.cr +++ b/src/responses/user_time_summary.cr @@ -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 = @@ -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 @@ -198,7 +200,9 @@ 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 @@ -206,7 +210,9 @@ module Responses @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