CASH-2563: Check for MISC parts
This commit is contained in:
parent
db95db31d8
commit
590473878e
1 changed files with 21 additions and 0 deletions
|
|
@ -1954,10 +1954,17 @@ export const actions = {
|
|||
}
|
||||
});
|
||||
|
||||
// Triggers bailout
|
||||
if (response.PartsNotFound) {
|
||||
return response;
|
||||
}
|
||||
|
||||
// Check if we only have MISC parts to trigger bailout
|
||||
const miscPartsResponse = checkIfMiscParts(response.data.partsOrQuestions);
|
||||
if (miscPartsResponse.PartsNotFound) {
|
||||
return miscPartsResponse;
|
||||
}
|
||||
|
||||
// Flatten location and name properties
|
||||
response.data.partsOrQuestions = convertGlassPieceNamingFromApi(
|
||||
response.data.partsOrQuestions
|
||||
|
|
@ -4407,3 +4414,17 @@ const timeSlotCallFlags = {
|
|||
shop: false,
|
||||
mobile: false,
|
||||
};
|
||||
|
||||
function checkIfMiscParts(partsOrQuestions) {
|
||||
if (!partsOrQuestions || partsOrQuestions.length === 0) {
|
||||
return { PartsNotFound: true };
|
||||
} else if (
|
||||
partsOrQuestions.length === 1 &&
|
||||
partsOrQuestions[0].parts &&
|
||||
partsOrQuestions[0].parts.length === 1 &&
|
||||
partsOrQuestions[0].parts[0].partNumber.startsWith("MISC")
|
||||
) {
|
||||
return { PartsNotFound: true };
|
||||
}
|
||||
return { PartsNotFound: false };
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue