WIP for Reporting. Pulled out calculations to utility functions.
This commit is contained in:
12
src/util/GetJobTarget.js
Normal file
12
src/util/GetJobTarget.js
Normal file
@@ -0,0 +1,12 @@
|
||||
export default function GetJobTarget(group, v_age, targets) {
|
||||
const targetsForGroup = targets.filter((t) => t.group === group);
|
||||
if (!targetsForGroup) return 0;
|
||||
const targetPc = targetsForGroup.filter(
|
||||
(t) => t.ageGte <= v_age && (t.ageLt ? t.ageLt > v_age : true)
|
||||
);
|
||||
if (targetPc.length === 0) return 100;
|
||||
else if (targetPc.length === 1) return targetPc[0].target;
|
||||
else {
|
||||
return 100;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user