From aa1236ec3861428293d955c9d812afe4ef043aa3 Mon Sep 17 00:00:00 2001 From: Michaela Brydon Date: Wed, 26 Jun 2024 10:41:42 -0400 Subject: [PATCH] Adding helper file --- src/helpers/capability-question-helper.js | 42 +++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 src/helpers/capability-question-helper.js diff --git a/src/helpers/capability-question-helper.js b/src/helpers/capability-question-helper.js new file mode 100644 index 00000000..757c979d --- /dev/null +++ b/src/helpers/capability-question-helper.js @@ -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; \ No newline at end of file