feat(cards): migrated cards over
This commit is contained in:
@@ -1,28 +1,41 @@
|
||||
import { lanes } from "./cyclecountCheck.js";
|
||||
|
||||
export const getCycleCountCheck = async (
|
||||
age: number = 1000,
|
||||
type: string = ""
|
||||
) => {
|
||||
export const getCycleCountCheck = async (age: number = 1000, type: any) => {
|
||||
/**
|
||||
* Get the lane data based on the age and type
|
||||
*/
|
||||
|
||||
let filteredLanes = lanes.filter((t: any) => t.DaysSinceLast >= age);
|
||||
let filteredLanes = lanes;
|
||||
|
||||
if (type === "empty") {
|
||||
let empty = lanes.filter((t: any) => t.rowType === type.toUpperCase());
|
||||
|
||||
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()
|
||||
message: `${empty.length} lanes that are of type ${type}.`,
|
||||
data: empty.sort(
|
||||
(a: any, b: any) => b.DaysSinceLast - a.DaysSinceLast
|
||||
),
|
||||
};
|
||||
} else {
|
||||
}
|
||||
|
||||
if (type != "") {
|
||||
let noType = lanes.filter((t: any) => t.DaysSinceLast >= age);
|
||||
|
||||
return {
|
||||
success: true,
|
||||
message: `${filteredLanes.length} lanes grabed that have not been cycle counted in the last ${age} days.`,
|
||||
data: filteredLanes,
|
||||
sucess: true,
|
||||
message: `${noType.length} lanes that are of type ${type} and have not been cycle counted in the last ${age} days.`,
|
||||
data: noType
|
||||
.filter((t: any) => t.rowType === type?.toUpperCase())
|
||||
.sort((a: any, b: any) => b.DaysSinceLast - a.DaysSinceLast),
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
success: true,
|
||||
message: `${filteredLanes.length} lanes grabed that have not been cycle counted in the last ${age} days.`,
|
||||
data: filteredLanes.sort(
|
||||
(a: any, b: any) => b.DaysSinceLast - a.DaysSinceLast
|
||||
),
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user