feat(cyclecountcheck): added i cycle count check this is in mem right now

if this becomes a resource hog we will move it to the db. no need for it to really be presitant
This commit is contained in:
2025-04-09 17:50:06 -05:00
parent 2e2699ab3c
commit 6665b77e09
6 changed files with 349 additions and 1 deletions

View File

@@ -0,0 +1,28 @@
import { lanes } from "./cyclecountCheck.js";
export const getCycleCountCheck = async (
age: number = 1000,
type: string = ""
) => {
/**
* Get the lane data based on the age and type
*/
let filteredLanes = lanes.filter((t: any) => t.DaysSinceLast >= age);
if (type != "") {
return {
sucess: true,
message: `${filteredLanes.length} lanes that are of type ${type} and have not been cycle counted in the last ${age} days.`,
data: filteredLanes.filter(
(t: any) => t.rowType === type.toUpperCase()
),
};
} else {
return {
success: true,
message: `${filteredLanes.length} lanes grabed that have not been cycle counted in the last ${age} days.`,
data: filteredLanes,
};
}
};