Best JavaScript code snippet using fast-check-monorepo
valueinput.js
Source:valueinput.js
1const e = require("express");2const express = require("express");3const router = express.Router();4let mongodb = require('../../function/mongodb');5let PREMIXserver = 'PREMIX_MASTER';6let COILCOATINGserver = 'COILCOATING_MASTER';7let HYDROPHILICserver = 'HYDROPHILIC_MASTER';8let PLXserver = 'PLX_MASTER';9let TRITRATINGserver = 'TRITRATING_MASTER';10let POWDERserver = 'POWDER_MASTER';11let LIQUIDserver = 'LIQUID_MASTER';12let NOXRUSTserver = 'NOXRUST_MASTER'13let dbin = 'specification';14let COLORwords = 'COLORwords';15let APPEARANCEwords = 'APPEARANCEwords';16router.post('/valueinput', async (req, res) => {17 console.log("valueinput");18 //-------------------------------------19 console.log(req.body);20 let input = req.body;21 //-------------------------------------22 let output = { "return": 'NOK' }23 try {24 let poid = `${input['poid']}`25 let plant = input['plant']26 let item = input['item']27 let value = `${input['value']}`28 let query = await mongodb.find(`${plant}dbMAIN`, 'MAIN', { $and: [{ "POID": poid }, { $or: [{ "DEP": "MANA" }, { "DEP": "STAFF" }] }] });29 if (query.length > 0) {30 // output = {"return":'OK'}31 // console.log(query[0][item] === null);32 if (query[0][item] === undefined) {33 console.log("NO HAVE WOY");34 } else {35 if (query[0][item]['T1Stc'] === 'lightgreen' || query[0][item]['T2Stc'] === 'lightgreen' || query[0][item]['T3Stc'] === 'lightgreen') {36 //37 output = { "return": 'WOK' }38 } else {39 let veT = '';40 let veTSt = '';41 let veTStc = '';42 if (query[0][item]['T1Stc'] === 'orange') {43 veT = 'T1';44 veTSt = 'T1St';45 veTStc = 'T1Stc';46 } else if (query[0][item]['T2Stc'] === 'orange') {47 veT = 'T2';48 veTSt = 'T2St';49 veTStc = 'T2Stc';50 } else if (query[0][item]['T3Stc'] === 'orange') {51 veT = 'T3';52 veTSt = 'T3St';53 veTStc = 'T3Stc';54 } else {55 veT = '';56 veTSt = '';57 veTStc = '';58 }59 if (veT !== '') {60 // console.log(query[0][item]);61 let setupdate = query[0][item];62 if (item == 'COLOR' || item == 'APPEARANCE') {63 // 64 let valueAC = value.toUpperCase();65 let val = `${setupdate['SPEC']}`.toUpperCase();66 let valueACdata = value;67 let valdata = `${setupdate['SPEC']}`;68 //.includes('')69 //if(val.includes(valueAC)){70 if (val.includes('-') || val.includes('to')) {71 if (val.includes(valueAC) == false) {72 // if(valueAC != val){73 setupdate[veT] = `${valueACdata}`;74 setupdate[veTSt] = 'M';75 setupdate[veTStc] = 'red';76 console.log("NO PASS");77 if (veTStc === 'T3Stc') {78 setupdate['AllSt'] = 'REJECT'79 setupdate['DEP'] = 'REJECT'80 }81 //------------------------------------82 let updv = {};83 updv[item] = setupdate;84 let upd = await mongodb.update(`${plant}dbMAIN`, 'MAIN', { $and: [{ "POID": poid }, { $or: [{ "DEP": "MANA" }, { "DEP": "STAFF" }] }] }, { $set: updv });85 output = { "return": 'OK' }86 //------------------------------------87 // }else if(valueAC == val){88 } else if (val.includes(valueAC)) {89 console.log("PASS");90 setupdate[veT] = `${valueACdata}`;91 setupdate[veTSt] = 'M';92 setupdate[veTStc] = 'lightgreen';93 setupdate['AllSt'] = 'PASS';94 console.log("PASS");95 //------------------------------------96 let updv = {};97 updv[item] = setupdate;98 let upd = await mongodb.update(`${plant}dbMAIN`, 'MAIN', { $and: [{ "POID": poid }, { $or: [{ "DEP": "MANA" }, { "DEP": "STAFF" }] }] }, { $set: updv });99 output = { "return": 'OK' }100 //------------------------------------101 }102 } else {103 if (valueAC != val) {104 setupdate[veT] = `${valueACdata}`105 setupdate[veTSt] = 'M'106 setupdate[veTStc] = 'red'107 console.log("NO PASS");108 if (veTStc === 'T3Stc') {109 setupdate['AllSt'] = 'REJECT'110 setupdate['DEP'] = 'REJECT'111 }112 //------------------------------------113 let updv = {};114 updv[item] = setupdate;115 let upd = await mongodb.update(`${plant}dbMAIN`, 'MAIN', { $and: [{ "POID": poid }, { $or: [{ "DEP": "MANA" }, { "DEP": "STAFF" }] }] }, { $set: updv });116 output = { "return": 'OK' }117 //------------------------------------118 } else if (valueAC == val) {119 console.log("PASS");120 setupdate[veT] = `${valueACdata}`121 setupdate[veTSt] = 'M'122 setupdate[veTStc] = 'lightgreen'123 setupdate['AllSt'] = 'PASS'124 console.log("PASS");125 //------------------------------------126 let updv = {};127 updv[item] = setupdate;128 let upd = await mongodb.update(`${plant}dbMAIN`, 'MAIN', { $and: [{ "POID": poid }, { $or: [{ "DEP": "MANA" }, { "DEP": "STAFF" }] }] }, { $set: updv });129 output = { "return": 'OK' }130 //------------------------------------131 }132 }133 } else {134 //135 let valueAC = parseFloat(value);136 let valueORI = value;137 let MIN = parseFloat(setupdate['SPEC']['LOW']);138 let MAX = parseFloat(setupdate['SPEC']['HI']);139 console.log(`${MIN}<${valueAC}<${MAX}`);140 if (valueAC < MIN || valueAC > MAX) {141 setupdate[veT] = valueORI;142 setupdate[veTSt] = 'M';143 setupdate[veTStc] = 'red';144 console.log("NO PASS");145 if (veTStc === 'T3Stc') {146 setupdate['AllSt'] = 'REJECT'147 setupdate['DEP'] = 'REJECT'148 }149 //------------------------------------150 let updv = {};151 updv[item] = setupdate;152 let upd = await mongodb.update(`${plant}dbMAIN`, 'MAIN', { $and: [{ "POID": poid }, { $or: [{ "DEP": "MANA" }, { "DEP": "STAFF" }] }] }, { $set: updv });153 output = { "return": 'OK' }154 //------------------------------------155 } else if (valueAC >= MIN && valueAC <= MAX) {156 console.log("PASS");157 setupdate[veT] = valueORI;158 setupdate[veTSt] = 'M';159 setupdate[veTStc] = 'lightgreen';160 setupdate['AllSt'] = 'PASS';161 console.log("PASS");162 //------------------------------------163 let updv = {};164 updv[item] = setupdate;165 let upd = await mongodb.update(`${plant}dbMAIN`, 'MAIN', { $and: [{ "POID": poid }, { $or: [{ "DEP": "MANA" }, { "DEP": "STAFF" }] }] }, { $set: updv });166 output = { "return": 'OK' }167 //------------------------------------168 }169 }170 }171 }172 }173 }174 }175 catch (err) {176 output = { "return": 'NOK' }177 }178 res.json(output);179});180router.post('/semiauto-valueinputget', async (req, res) => {181 console.log("semiauto-valueinputget");182 //-------------------------------------183 console.log(req.body);184 let input = req.body;185 //-------------------------------------186 let output = { "return": 'NOK' }187 try {188 let MATCP = input['poid'].substring(0, 8);189 let PO = input['poid'].substring(12, 18);190 let poid = `${input['poid']}`191 let PREMIX = await mongodb.find(PREMIXserver, dbin, { "MATNO": MATCP });192 let COILCOATING = await mongodb.find(COILCOATINGserver, dbin, { "MATNO": MATCP });193 let HYDROPHILIC = await mongodb.find(HYDROPHILICserver, dbin, { "MATNO": MATCP });194 let PLX = await mongodb.find(PLXserver, dbin, { "MATNO": MATCP });195 let TRITRATING = await mongodb.find(TRITRATINGserver, dbin, { "MATNO": MATCP });196 let POWDER = await mongodb.find(POWDERserver, dbin, { "MATNO": MATCP });197 let LIQUID = await mongodb.find(LIQUIDserver, dbin, { "MATNO": MATCP });198 let NOXRUST = await mongodb.find(NOXRUSTserver, dbin, { "MATNO": MATCP });199 let plant = ``;200 if (TRITRATING.length > 0) {201 plant = 'TRITRATING'202 } else if (COILCOATING.length > 0) {203 plant = 'COILCOATING'204 } else if (HYDROPHILIC.length > 0) {205 plant = 'HYDROPHILIC'206 } else if (PLX.length > 0) {207 plant = 'PLX'208 } else if (PREMIX.length > 0) {209 plant = 'PREMIX'210 } else if (POWDER.length > 0) {211 plant = 'POWDER'212 }213 else if (LIQUID.length > 0) {214 plant = 'LIQUID'215 } else if (NOXRUST.length > 0) {216 plant = 'NOXRUST'217 } else{218 res.json(output);219 }220 let output1 = await mongodb.find(COLORwords, dbin, { "plant": plant });221 let output2 = await mongodb.find(APPEARANCEwords, dbin, { "plant": plant });222 let query = await mongodb.find(`${plant}dbMAIN`, 'MAIN', { "POID": poid });223 if (query.length > 0) {224 output = query[0];225 output['CO'] = output1;226 output['AP'] = output2;227 output["return"] = 'OK';228 }229 // console.log(output);230 }231 catch (err) {232 output = { "return": 'NOK' }233 }234 res.json(output);235});236router.post('/valueinputadj', async (req, res) => {237 console.log("valueinputadj");238 //-------------------------------------239 console.log(req.body);240 let input = req.body;241 //-------------------------------------242 let output = { "return": 'NOK' }243 try {244 let poid = `${input['poid']}`245 let plant = input['plant']246 let item = input['item']247 let value = `${input['value']}`248 let query = await mongodb.find(`${plant}dbMAIN`, 'MAIN', { $and: [{ "POID": poid }, { $or: [{ "DEP": "MANA" }, { "DEP": "STAFF" }] }] });249 if (query.length > 0) {250 if (query[0][item] === undefined) {251 console.log("NO HAVE WOY");252 } else if (query[0][item]['T1Stc'] === 'lightgreen' || query[0][item]['T2Stc'] === 'lightgreen' || query[0][item]['T3Stc'] === 'lightgreen') {253 let veT = '';254 let veTSt = '';255 let veTStc = '';256 if (query[0][item]['T1Stc'] === 'orange') {257 veT = 'T1';258 veTSt = 'T1St';259 veTStc = 'T1Stc';260 } else if (query[0][item]['T2Stc'] === 'orange') {261 veT = 'T2';262 veTSt = 'T2St';263 veTStc = 'T2Stc';264 } else if (query[0][item]['T3Stc'] === 'orange') {265 veT = 'T3';266 veTSt = 'T3St';267 veTStc = 'T3Stc';268 } else {269 veT = '';270 veTSt = '';271 veTStc = '';272 }273 if (veT !== '') {274 // console.log(query[0][item]);275 let setupdate = query[0][item];276 if (item == 'COLOR' || item == 'APPEARANCE') {277 // 278 let valueAC = value.toUpperCase();279 let val = `${setupdate['SPEC']}`.toUpperCase();280 let valueACdata = value;281 let valdata = `${setupdate['SPEC']}`;282 if (val.includes('-') || val.includes('to')) {283 if (val.includes(valueAC) == false) {284 // if(valueAC != val){285 setupdate[veT] = `${valueACdata}`286 setupdate[veTSt] = 'M-ADJ'287 setupdate[veTStc] = 'red'288 console.log("NO PASS");289 if (veTStc === 'T3Stc') {290 setupdate['AllSt'] = 'REJECT'291 setupdate['DEP'] = 'REJECT'292 }293 //------------------------------------294 let updv = {};295 updv[item] = setupdate;296 let upd = await mongodb.update(`${plant}dbMAIN`, 'MAIN', { $and: [{ "POID": poid }, { $or: [{ "DEP": "MANA" }, { "DEP": "STAFF" }] }] }, { $set: updv });297 output = { "return": 'OK' }298 //------------------------------------299 // }else if(valueAC == val){300 } else if (val.includes(valueAC)) {301 console.log("PASS");302 setupdate[veT] = `${valueACdata}`303 setupdate[veTSt] = 'M-ADJ'304 setupdate[veTStc] = 'lightgreen'305 setupdate['AllSt'] = 'PASS'306 console.log("PASS");307 //------------------------------------308 let updv = {};309 updv[item] = setupdate;310 let upd = await mongodb.update(`${plant}dbMAIN`, 'MAIN', { $and: [{ "POID": poid }, { $or: [{ "DEP": "MANA" }, { "DEP": "STAFF" }] }] }, { $set: updv });311 output = { "return": 'OK' }312 //------------------------------------313 }314 } else {315 if (valueAC != val) {316 setupdate[veT] = `${valueACdata}`317 setupdate[veTSt] = 'M-ADJ'318 setupdate[veTStc] = 'red'319 console.log("NO PASS");320 if (veTStc === 'T3Stc') {321 setupdate['AllSt'] = 'REJECT'322 setupdate['DEP'] = 'REJECT'323 }324 //------------------------------------325 let updv = {};326 updv[item] = setupdate;327 let upd = await mongodb.update(`${plant}dbMAIN`, 'MAIN', { $and: [{ "POID": poid }, { $or: [{ "DEP": "MANA" }, { "DEP": "STAFF" }] }] }, { $set: updv });328 output = { "return": 'OK' }329 //------------------------------------330 } else if (valueAC == val) {331 console.log("PASS");332 setupdate[veT] = `${valueACdata}`333 setupdate[veTSt] = 'M-ADJ'334 setupdate[veTStc] = 'lightgreen'335 setupdate['AllSt'] = 'PASS'336 console.log("PASS");337 //------------------------------------338 let updv = {};339 updv[item] = setupdate;340 let upd = await mongodb.update(`${plant}dbMAIN`, 'MAIN', { $and: [{ "POID": poid }, { $or: [{ "DEP": "MANA" }, { "DEP": "STAFF" }] }] }, { $set: updv });341 output = { "return": 'OK' }342 //------------------------------------343 }344 }345 } else {346 //347 let valueAC = parseFloat(value);348 let valueORI = value;349 let MIN = parseFloat(setupdate['SPEC']['LOW']);350 let MAX = parseFloat(setupdate['SPEC']['HI']);351 console.log(`${MIN}<${valueAC}<${MAX}`);352 if (valueAC < MIN || valueAC > MAX) {353 setupdate[veT] = valueORI;354 setupdate[veTSt] = 'M-ADJ'355 setupdate[veTStc] = 'red'356 console.log("NO PASS");357 if (veTStc === 'T3Stc') {358 setupdate['AllSt'] = 'REJECT'359 setupdate['DEP'] = 'REJECT'360 }361 //------------------------------------362 let updv = {};363 updv[item] = setupdate;364 let upd = await mongodb.update(`${plant}dbMAIN`, 'MAIN', { $and: [{ "POID": poid }, { $or: [{ "DEP": "MANA" }, { "DEP": "STAFF" }] }] }, { $set: updv });365 output = { "return": 'OK' }366 //------------------------------------367 } else if (valueAC >= MIN && valueAC <= MAX) {368 console.log("PASS");369 setupdate[veT] = valueORI;370 setupdate[veTSt] = 'M-ADJ'371 setupdate[veTStc] = 'lightgreen'372 setupdate['AllSt'] = 'PASS'373 console.log("PASS");374 //------------------------------------375 let updv = {};376 updv[item] = setupdate;377 let upd = await mongodb.update(`${plant}dbMAIN`, 'MAIN', { $and: [{ "POID": poid }, { $or: [{ "DEP": "MANA" }, { "DEP": "STAFF" }] }] }, { $set: updv });378 output = { "return": 'OK' }379 //------------------------------------380 }381 }382 }383 } else {384 output = { "return": 'WOK' }385 }386 }387 }388 catch (err) {389 output = { "return": 'NOK' }390 }391 res.json(output);392});...
index.js
Source:index.js
1let isStarted = false;2const Telegraf = require('telegraf');3const bot = new Telegraf('5023328540:AAFJN10ERBmd20mKJGajxGRRLEVvB1Xgn7k')4let questions = [5 //GRUPO A6 {part: "Brazo", value: -1, valueOptions: 0, minValue: 1, maxValue: 6, img:"./img/brazos.jpeg"},7 {part: "Ante brazo", value: -1, minValue: 1, maxValue: 3, img:"./img/antebrazo.jpeg"},8 {part: "Muñeca", value: -1, minValue: 1, maxValue: 4, img:"./img/muñeca.jpeg"},9 {part: "Giro de muñeca", value: -1, minValue: 1, maxValue: 2, img:"./img/giromuñeca.jpeg"},10 {part: "Actividad muscular grupo A", value: -1, minValue: 0, maxValue: 1, img:"./img/actividadmuscular.jpeg"},11 {part: "Fuerza ejercida grupo A", value: -1, minValue: 0, maxValue: 3, img:"./img/fuerzaejercida.jpeg"},12 {part: "Grupo B", value: -1, message: "Asà que manos a la obra con el siguiente grupo, Ahora empezaremos por el grupo B. "},13 //GRUPO B14 {part: "Cuello", value: -1, minValue: 1, maxValue: 6, img:"./img/cuello.jpeg"},15 {part: "Tronco", value: -1, minValue: 1, maxValue: 6, img:"./img/tronco.jpeg"},16 {part: "Piernas", value: -1, minValue: 1, maxValue: 2, img:"./img/piernas.jpeg"},17 {part: "Actividad muscular grupo B", value: -1, minValue: 0, maxValue: 1, img:"./img/actividadmuscular.jpeg"},18 {part: "Fuerza ejercida grupo B", value: -1, minValue: 0, maxValue: 3, img:"./img/fuerzaejercida.jpeg"}19];20bot.use((ctx, next) => {21 console.log(ctx.message)22 if (ctx.message.text != "/start") {23 24 // if (isStarted) {25 // startQuestion(ctx);26 // isStarted = false;27 // }else{ 28 let isCorrect=validAnswer(ctx.message.text);29 30 if (!isCorrect) {31 let question = questions.find(f => f.value == -1);32 if (question != undefined) { 33 ctx.reply(AnswerIncorrect(question.part));34 }35 }else{36 if (questions.find(f => f.value == -1) != undefined) {37 questions.find(f => f.value == -1).value = parseInt(ctx.message.text);38 if (questions.find(f => f.value == -1) != undefined) {39 let question = questions.find(f => f.value == -1); 40 if (question != undefined) {41 if (question.part == "Grupo B") {42 ctx.reply(question.message);43 questions.find(f => f.value == -1).value = 1;44 question = questions.find(f => f.value == -1);45 }46 ctx.replyWithPhoto({ source:question.img }, { caption: "Visualice la imagen" });47 let options = [];48 49 for (let index = 0; index < question.maxValue; index++) {50 options.push((question.minValue + index).toString()); 51 }52 53 if (question.minValue == 0) {54 options.push(question.maxValue.toString());55 }56 57 bot.telegram.sendMessage(ctx.chat.id, getParameter(question.part), {58 'reply_markup': {59 'keyboard': [options],60 resize_keyboard: true,61 one_time_keyboard: true,62 force_reply: true63 }64 });65 }else{66 ctx.reply(`Muchas gracias por usar`);67 }68 }else{69 ctx.reply(calculateTotal(), {parse_mode : "HTML"});70 setTimeout(function(){ctx.reply(`Para volver a consultar presione una tecla`)}, 1000);71 questions.forEach(d => {d.value = -1});72 isStarted = true;73 }74 }75 }76 // }77 } 78 ctx.state.users = 75;79 next(ctx);80})81bot.start((ctx) => {82 ctx.reply(`¡Hola! Bienvenid@, Soy calculadorDog y seré tu bot de ayuda, pulsa el botón de inicio y empezamos con tus análisis ergonómicos. 83 Recordemos que el método Rula se divide en dos Grupos: 84 GRUPO A) Brazo, antebrazo y muñeca.85 GRUPO B) Cuello, tronco y piernas.86 87 Antes de empezar, ¿hablaremos de cómo funciona? yo CalculadorDog te ayudare hacer el análisis mucho más rápido, solo tienes que elegir y seleccionar según tus datos Y yo me encargare de hacer la suma de tus datos recolectados para el método RULA.88 89 Ansioso, para que estés más seguro lo que analizare, serán los dos grupos que están compuesto por:90 91 Grupo A) Dentro de este grupo se analizará también el grupo C que es resultado del grupo A + la actividad muscular + fuerzas ejercidas.92 Grupo B) Dentro de este grupo se analizará también el grupo D que es resultado del grupo B + la actividad muscular + fuerzas ejercidas.93 Y por último te daremos la puntuación final de método RULA y el nivel de riesgo. Mucho más fácil. \n\n94 <b>Recuerda que debes visualizar atentamente la imagen , en algunas ilustraciones visualizaras un número que indicara la posición en la que te encuentras y agregar bonificaciones a la posición que estas haciendo, por lo que deberás sumarla y seleccionar tu respuesta. </b>95 `, {parse_mode : "HTML"});96 ctx.reply(`Asà que manos a la obra, Empezaremos por el grupo A.`);97 startQuestion(ctx);98})99function startQuestion(ctx){100 let question = questions.find(f => f.value == -1);101 ctx.replyWithPhoto({ source:question.img }, { caption: "Visualice la imagen" });102 103 let options = [];104 for (let index = 0; index < question.maxValue; index++) {105 options.push((question.minValue + index).toString()); 106 }107 bot.telegram.sendMessage(ctx.chat.id, getParameter(question.part), {108 'reply_markup': {109 'keyboard': [options],110 resize_keyboard: true,111 one_time_keyboard: true,112 force_reply: true113 }114 });115}116function getParameter(type) {117 return `Ingrese el ángulo de la posición del ${type}`;118}119function validAnswer(value){ ///Validar de que no coloque un valor difetente al del rango120 let question = questions.find(f => f.value == -1);121if (value >= 0) {122 123 if (value < 0 || value > 120) {124 return false;125 }126 if (value >= question.minValue && value <= question.maxValue ) {127 return true;128 }129 return false;130}131return false;132}133function AnswerIncorrect(parameter){134 return `El valor ingresado es incorrecto, por favor vuelva a diligenciar el dato de: ${parameter}`;135}136var cuadroA = [137[1,2,2,2,2,3,3,3],138[2,2,2,2,3,3,3,3],139[2,3,3,3,3,3,4,4],140[2,3,3,3,3,4,4,4],141[3,3,3,3,3,4,4,4],142[3,4,4,4,4,4,5,5],143[3,3,4,4,4,4,5,5],144[3,4,4,4,4,4,5,5],145[4,4,4,4,4,5,5,5],146[4,4,4,4,4,5,5,5],147[4,4,4,4,4,5,5,5],148[4,4,4,5,5,5,6,6],149[5,5,5,5,5,6,6,7],150[5,6,6,6,6,7,7,7],151[6,6,6,7,7,7,7,8],152[7,7,7,7,7,8,8,9],153[8,8,8,8,8,9,9,9],154[9,9,9,9,9,9,9,9]155];156var cuadroB = [157 [1,3,2,3,3,4,5,5,6,6,7,7],158 [2,3,2,3,4,5,5,5,6,7,7,7],159 [3,3,3,4,4,5,5,6,6,7,7,7],160 [5,5,5,6,6,7,7,7,7,7,8,8],161 [7,7,7,7,7,8,8,8,8,8,8,8],162 [8,8,8,8,8,8,8,9,9,9,9,9]163];164var tablaFinal = [165 [1,2,3,3,4,5,5],166 [2,2,3,4,4,5,5],167 [3,3,3,4,4,5,6],168 [3,3,3,4,5,6,6],169 [4,4,4,5,6,7,7],170 [4,4,5,6,6,7,7],171 [5,5,6,6,7,7,7],172 [5,5,6,7,7,7,7]173]174function calculateAC() {175 let valueBrazo = questions.find(g => g.part == "Brazo").value;176 let ante_Brazo = questions.find(g => g.part == "Ante brazo").value;177 let muneca = questions.find(g => g.part == "Muñeca").value;178 let girodemuneca = questions.find(g => g.part == "Giro de muñeca").value;179 let position = [cuadroA[(valueBrazo * 3) - 3],cuadroA[(valueBrazo * 3) - 2],cuadroA[(valueBrazo * 3) -1]]180 position = position[ante_Brazo - 1];181 let value = position[(muneca * 2 - ( girodemuneca == 2 ? 0 : 1)) - 1];182 return [value, questions.find(g => g.part == "Actividad muscular grupo A").value + questions.find(g => g.part == "Fuerza ejercida grupo A").value];183}184function calculateBD() {185 let cuello = questions.find(g => g.part == "Cuello").value;186 let tronco = questions.find(g => g.part == "Tronco").value;187 let piernas = questions.find(g => g.part == "Piernas").value;188 let position = cuadroB[cuello -1]189 let value = position[(tronco * 2 - ( piernas == 2 ? 0 : 1)) - 1];190 return [value, questions.find(g => g.part == "Actividad muscular grupo B").value + questions.find(g => g.part == "Fuerza ejercida grupo B").value];191}192function calculateTotal(){193 let valueAC = calculateAC();194 let valueBD = calculateBD();195 let total = 0;196 if ((valueAC[0] + valueAC[1]) > 8 || (valueBD[0] + valueBD[1]) > 7) {197 total = 7;198 }else{199 total = tablaFinal[(valueAC[0] + valueAC[1]) - 1][(valueBD[0] + valueBD[1]) - 1]; 200 }201 console.log("c: ", valueAC[1]);202 console.log("d: ", valueBD[1]);203 let message = `Totales Obtenidos: \n204 205 Total Grupo A : ${(valueAC[0])} \n206 Total Grupo B : ${(valueBD[0])} \n207 Total Grupo C : ${(valueAC[0] + valueAC[1])} \n208 Total Grupo D : ${(valueBD[0] + valueBD[1])} \n209 <b>Puntuación final RULA: ${total}\n\n</b>`;210 switch (total) {211 case 1:212 case 2:213 message+= ` Nivel de riesgo: 1\n Puntuaciones entre 1 y 2 indican que el riesgo de la tarea resulta aceptable y no son precisos cambios.`;214 break;215 case 3:216 case 4:217 message+= ` Nivel de riesgo: 2\n Puntuaciones entre 3 y 4 indican que es necesario un estudio a profundidad del puesto porque puede requerir cambios.`;218 break;219 case 5:220 case 6:221 message+= ` Nivel de riesgo: 3\n Puntuaciones entre 5 y 6 indican que los cambios son necesarios.`;222 break;223 case 7:224 message+= ` Nivel de riesgo: 4\n Puntuación de 7 indica que los cambios son urgentes.`225 break;226 }227 message += `\n\n Espero a verte sido de mucha ayuda en tus análisis, GUAUBYE.`228 229 return message;230}...
option.component.js
Source:option.component.js
1import React, { useEffect } from "react";2import { useState } from "react";3import userService from "../../service/user-service";4const OptionMapper = ({axiosMethod}) => {5 const [dataFinal, setData] = useState([]);6 7 useEffect(() => {8 axiosMethod?.then((result) => setData(result.data));9 },[]);10 return (11 <>12 {dataFinal.map((valueAc) => (13 <option value={valueAc}>{valueAc}</option>14 ))}15 16 </>17 18 );19};...
Using AI Code Generation
1const valueAC = require('fast-check-monorepo').valueAC;2const valueAC = require('fast-check-monorepo').valueAC;3const valueAC = require('fast-check-monorepo').valueAC;4const valueAC = require('fast-check-monorepo').valueAC;5const valueAC = require('fast-check-monorepo').valueAC;6const valueAC = require('fast-check-monorepo').valueAC;7const valueAC = require('fast-check-monorepo').valueAC;8const valueAC = require('fast-check-monorepo').valueAC;9const valueAC = require('fast-check-monorepo').valueAC;10const valueAC = require('fast-check-monorepo').valueAC;11const valueAC = require('fast-check-monorepo').valueAC;12const valueAC = require('fast-check-monorepo').valueAC;13valueAC(
Using AI Code Generation
1const { valueAC } = require('fast-check-monorepo');2const { valueAC } = require('fast-check-monorepo');3const { valueAC } = require('fast-check-monorepo');4const { valueAC } = require('fast-check-monorepo');5The message to use for the pull request. Default: `chore(monorepo): update fast-check`6The title to use for the pull request. Default: `chore(monorepo): update fast-check`7The body to use for the pull request. Default: `chore(monorepo): update fast-check`
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!