Adding helper file
This commit is contained in:
parent
15eabdab77
commit
aa1236ec38
1 changed files with 42 additions and 0 deletions
42
src/helpers/capability-question-helper.js
Normal file
42
src/helpers/capability-question-helper.js
Normal 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;
|
||||||
Loading…
Reference in a new issue