From 4b3a2d0ec246417c26889a95e1dd2d2818d75cc4 Mon Sep 17 00:00:00 2001 From: analuizaff Date: Sun, 3 Oct 2021 13:40:57 -0300 Subject: [PATCH] fixing a ingestion issue --- .../forms/AssembleIngestionObject.js | 21 ++++++-------- src/app/screens/LoginScreen.js | 2 +- src/app/screens/RainSharingDataScreen.js | 29 ++++++++++++++----- .../screens/RiverFloodSharingDataScreen.js | 10 ++++--- src/app/screens/SharingFloodZonesScreen.js | 10 ++++--- src/package-lock.json | 11 +++++-- 6 files changed, 51 insertions(+), 32 deletions(-) diff --git a/src/app/components/forms/AssembleIngestionObject.js b/src/app/components/forms/AssembleIngestionObject.js index dbc6a54..5f4873d 100644 --- a/src/app/components/forms/AssembleIngestionObject.js +++ b/src/app/components/forms/AssembleIngestionObject.js @@ -2,16 +2,15 @@ import moment from "moment"; import React from "react"; import sendFormAnswer from "../../api/Ingestion/sendFormAnswer"; -const AssembleIngestionObject = ({ - images, - description, +const AssembleIngestionObject = ( + { images, description }, situation, code, location, date, time, - address, -}) => { + address +) => { const ingestionObject = { responseData: { array_to_json: [ @@ -26,9 +25,7 @@ const AssembleIngestionObject = ({ fieldsanswerseventaddress: address, fieldsanswerseventdate: moment(date).format("DD-MM-YYYY"), fieldsanswerseventtime: moment(time).format("HH:mm"), - fieldsanswercomment: description - ? description - : "descrição do evento", + fieldsanswerscomment: description, }, ], }, @@ -65,7 +62,7 @@ const AssembleIngestionPluviometer = ({ }; }; -const AssembleIngestionPluvRegistration = ({date, time, user}) => { +const AssembleIngestionPluvRegistration = ({ date, time, user }) => { const pluvResgistrationObject = { responseData: { array_to_json: [ @@ -73,13 +70,13 @@ const AssembleIngestionPluvRegistration = ({date, time, user}) => { formcode: "PLUVIOMETER_REGISTRATION", formsanswersuserinformer: "admin@wpd.com", //user fieldsanswerslongitude: -46.5637, //location["longitude"], - fieldsanswerslatitude: -23.6230,//location["latitude"], + fieldsanswerslatitude: -23.623, //location["latitude"], fields: [ { - fieldsanswerseventaddress: "Rua Rio de Janeiros, 81",//address + fieldsanswerseventaddress: "Rua Rio de Janeiros, 81", //address fieldsanswerseventdate: moment(date).format("DD-MM-YYYY"), fieldsanswerseventtime: moment(time).format("HH:mm"), - fieldsanswersinstitutename: "E. E. Vagner", + fieldsanswersinstitutename: "E. E. Vagner", fieldsanswerrinstitutetype: "Escola", }, ], diff --git a/src/app/screens/LoginScreen.js b/src/app/screens/LoginScreen.js index be4771e..4518f37 100644 --- a/src/app/screens/LoginScreen.js +++ b/src/app/screens/LoginScreen.js @@ -78,7 +78,7 @@ export default function LoginScreen(props) { const handleSubmit = async (name, password, setLoginFailed) => { const result = await authApi.login(name, password); - console.log(result.ok); + // console.log(result.ok); if (!result.ok) return setLoginFailed(true); setLoginFailed(false); diff --git a/src/app/screens/RainSharingDataScreen.js b/src/app/screens/RainSharingDataScreen.js index ba39bbc..a56e713 100644 --- a/src/app/screens/RainSharingDataScreen.js +++ b/src/app/screens/RainSharingDataScreen.js @@ -57,15 +57,17 @@ function RainSharingDataScreen(props) { setError(true); return; } - AssembleIngestionObject({ - ...values, + AssembleIngestionObject( + { + ...values, + }, rainSituation, code, location, date, time, - address, - }); + address + ); // insertRainData({ ...values, rain, location, date, time, address }); showMessage({ message: "Informação enviada!", @@ -91,13 +93,19 @@ function RainSharingDataScreen(props) { > {setRain(0); setRainSituation("SEM CHUVA")}} + onPress={() => { + setRain(0); + setRainSituation("SEM CHUVA"); + }} SvgImage={assets.rainLevel.Rain_0_5} label={"SEM CHUVA"} isToggle={rain == 0} /> {setRain(1); setRainSituation("CHUVA FRACA")}} + onPress={() => { + setRain(1); + setRainSituation("CHUVA FRACA"); + }} SvgImage={assets.rainLevel.Rain_1_5} label={"CHUVA FRACA"} isToggle={rain == 1} @@ -107,14 +115,19 @@ function RainSharingDataScreen(props) { {setRain(2); setRainSituation("CHUVA MODERADA")}} + onPress={() => { + setRain(2); + setRainSituation("CHUVA MODERADA"); + }} SvgImage={assets.rainLevel.Rain_2_5} label={"CHUVA MODERADA"} isToggle={rain == 2} /> {setRain(3), setRainSituation("CHUVA FORTE")}} + onPress={() => { + setRain(3), setRainSituation("CHUVA FORTE"); + }} SvgImage={assets.rainLevel.Rain_3_5} label={"CHUVA FORTE"} isToggle={rain == 3} diff --git a/src/app/screens/RiverFloodSharingDataScreen.js b/src/app/screens/RiverFloodSharingDataScreen.js index 602eba3..647d928 100644 --- a/src/app/screens/RiverFloodSharingDataScreen.js +++ b/src/app/screens/RiverFloodSharingDataScreen.js @@ -60,15 +60,17 @@ function RiverFloodSharingDataScreen(props) { return; } // insertRiverData({ ...values, riverScale, location, date, time, address,}); - AssembleIngestionObject({ - ...values, + AssembleIngestionObject( + { + ...values, + }, riverSituation, code, location, date, time, - address, - }); + address + ); showMessage({ message: "Informação enviada!", duration: 1950, diff --git a/src/app/screens/SharingFloodZonesScreen.js b/src/app/screens/SharingFloodZonesScreen.js index 4351679..7641329 100644 --- a/src/app/screens/SharingFloodZonesScreen.js +++ b/src/app/screens/SharingFloodZonesScreen.js @@ -58,15 +58,17 @@ function SharingFloodZonesScreen(props) { return; } //insertFloodZone({ ...values, passable, location, date, time, address, }); - AssembleIngestionObject({ - ...values, + AssembleIngestionObject( + { + ...values, + }, floodSituation, code, location, date, time, - address, - }); + address + ); showMessage({ message: "Informação enviada!", duration: 1950, diff --git a/src/package-lock.json b/src/package-lock.json index 28540a1..85db95f 100644 --- a/src/package-lock.json +++ b/src/package-lock.json @@ -16712,6 +16712,11 @@ "point-in-polygon": "^1.0.1" } }, + "react-native-dropdown-picker": { + "version": "5.1.27", + "resolved": "https://registry.npmjs.org/react-native-dropdown-picker/-/react-native-dropdown-picker-5.1.27.tgz", + "integrity": "sha512-lQxn7kiVC+0BSHN4AMOwngR8jUgGMqhbw5vjeuTmlyYbbirfTrXXYqWNlpEs8+XUlAHmPgIkMVZrnQ3e4FIh4w==" + }, "react-native-flash-message": { "version": "0.1.18", "resolved": "https://registry.npmjs.org/react-native-flash-message/-/react-native-flash-message-0.1.18.tgz", @@ -17163,9 +17168,9 @@ } }, "react-navigation-header-buttons": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/react-navigation-header-buttons/-/react-navigation-header-buttons-7.0.1.tgz", - "integrity": "sha512-ggIXhshnRv3Kaqw1ZlZLqMPtBOsLY4FLxxEOCHKe/XuWVfZGPmMqZBC/S4H8cQgIGRyFNOrypXF69Hb7fXMWNg==", + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/react-navigation-header-buttons/-/react-navigation-header-buttons-7.0.2.tgz", + "integrity": "sha512-9upSzWAaIYalBwwMDIUa9XtquVElFAfPStjzl4SvV7XE4HAIcnafDGcMApyxn5zf3N4VvDSRTB9xfEiDzr98jg==", "requires": { "invariant": ">=2" }