From bd7e3590c021af73f513ca289027dd32470e1be1 Mon Sep 17 00:00:00 2001 From: Piv <18462828+Piv200@users.noreply.github.com> Date: Tue, 21 Mar 2023 21:58:57 +1030 Subject: [PATCH] Add consideration for potentially incorrect cost driver calculations --- src/overhead_allocation.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/overhead_allocation.rs b/src/overhead_allocation.rs index 9ef8187..4ec3209 100644 --- a/src/overhead_allocation.rs +++ b/src/overhead_allocation.rs @@ -245,6 +245,13 @@ where let allocation_statistic = area.get("AllocationStatistic").unwrap(); let department_type: DepartmentType = DepartmentType::from(area.get("Type").unwrap()); + // TODO: I don't think this check is enough. I think we actually need to check the allocation statistic too, + // and whether it holds the account types is cares about. If it's the wrong account type, then we should discard + // all ccs in this area. + // This is because I found some lines where the account is the right type (e.g. expense), however there was + // an overhead cc in that account, which had an area that had an allocation statistic that only applied + // to unit accounts, so that cost centre probably shouldn't have been included at all. I don't think it + // messed up the calculation in this instance, but there may be other cases that do get tripped up by this if department_type == DepartmentType::Overhead { let current_area_ccs = area_ccs.get(area_name);