Adding helper file

This commit is contained in:
Michaela Brydon 2024-06-26 10:41:42 -04:00
parent 15eabdab77
commit aa1236ec38

View file

@ -0,0 +1,42 @@
/**
* Given a part and a capabilityAnswerResult, returns the same part but with update
* recalibrationType and requiresRecalibration values based on the capabilityAnswerResult
* @param {*} part
* @param {*} capabilityAnswerResult
* @returns part
*/
function setPartRecalibrationProperties(part, capabilityAnswerResult) {
part.RecalibrationType = capabilityAnswerResult.Result1;
part.RequiresRecalibration = capabilityAnswerResult.Result2 != "0";
return part;
}
// function x(capabilityQuestionAnswers, glassLocation) {
// }
// setAllPartRecalibrationProperties(parts, context, { payload, pageNameToLog }) {
// const glassLocation = payload;
// const pageData = context.getters.pageData(fmgPageValues.CAPABILITY_QUESTIONS);
// const part = pageData.partsOrQuestions.find((x) => x.glassLocation === glassLocation)
// .parts[0];
// const capabilityQuestionAnswers = context.getters.damage.capabilityQuestionAnswers;
// const capabilityQuestionAnswersForPart = capabilityQuestionAnswers.find(
// (x) => x.glassLocation === glassLocation
// );
// return globalMethods.callHttpClient({
// method: endpoints.GetPartFromCapabilityAnswer.method,
// endpoint: endpoints.GetPartFromCapabilityAnswer.url,
// payload: {
// part,
// capabilityAnswerResults: capabilityQuestionAnswersForPart,
// },
// logApiCall: true,
// pageNameToLog: pageNameToLog,
// });
// },
export default setPartRecalibrationProperties;