Add consideration for potentially incorrect cost driver calculations

This commit is contained in:
Piv
2023-03-21 21:58:57 +10:30
parent 3ba8bf6e84
commit bd7e3590c0

View File

@@ -245,6 +245,13 @@ where
let allocation_statistic = area.get("AllocationStatistic").unwrap(); let allocation_statistic = area.get("AllocationStatistic").unwrap();
let department_type: DepartmentType = DepartmentType::from(area.get("Type").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 { if department_type == DepartmentType::Overhead {
let current_area_ccs = area_ccs.get(area_name); let current_area_ccs = area_ccs.get(area_name);