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:
@@ -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,
|
||||
};
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user