Browse Source

fixing a ingestion issue

master
analuizaff 3 years ago
parent
commit
4b3a2d0ec2
  1. 21
      src/app/components/forms/AssembleIngestionObject.js
  2. 2
      src/app/screens/LoginScreen.js
  3. 29
      src/app/screens/RainSharingDataScreen.js
  4. 10
      src/app/screens/RiverFloodSharingDataScreen.js
  5. 10
      src/app/screens/SharingFloodZonesScreen.js
  6. 11
      src/package-lock.json

21
src/app/components/forms/AssembleIngestionObject.js

@ -2,16 +2,15 @@ import moment from "moment";
import React from "react"; import React from "react";
import sendFormAnswer from "../../api/Ingestion/sendFormAnswer"; import sendFormAnswer from "../../api/Ingestion/sendFormAnswer";
const AssembleIngestionObject = ({
images,
description,
const AssembleIngestionObject = (
{ images, description },
situation, situation,
code, code,
location, location,
date, date,
time, time,
address,
}) => {
address
) => {
const ingestionObject = { const ingestionObject = {
responseData: { responseData: {
array_to_json: [ array_to_json: [
@ -26,9 +25,7 @@ const AssembleIngestionObject = ({
fieldsanswerseventaddress: address, fieldsanswerseventaddress: address,
fieldsanswerseventdate: moment(date).format("DD-MM-YYYY"), fieldsanswerseventdate: moment(date).format("DD-MM-YYYY"),
fieldsanswerseventtime: moment(time).format("HH:mm"), 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 = { const pluvResgistrationObject = {
responseData: { responseData: {
array_to_json: [ array_to_json: [
@ -73,13 +70,13 @@ const AssembleIngestionPluvRegistration = ({date, time, user}) => {
formcode: "PLUVIOMETER_REGISTRATION", formcode: "PLUVIOMETER_REGISTRATION",
formsanswersuserinformer: "admin@wpd.com", //user formsanswersuserinformer: "admin@wpd.com", //user
fieldsanswerslongitude: -46.5637, //location["longitude"], fieldsanswerslongitude: -46.5637, //location["longitude"],
fieldsanswerslatitude: -23.6230,//location["latitude"],
fieldsanswerslatitude: -23.623, //location["latitude"],
fields: [ fields: [
{ {
fieldsanswerseventaddress: "Rua Rio de Janeiros, 81",//address
fieldsanswerseventaddress: "Rua Rio de Janeiros, 81", //address
fieldsanswerseventdate: moment(date).format("DD-MM-YYYY"), fieldsanswerseventdate: moment(date).format("DD-MM-YYYY"),
fieldsanswerseventtime: moment(time).format("HH:mm"), fieldsanswerseventtime: moment(time).format("HH:mm"),
fieldsanswersinstitutename: "E. E. Vagner",
fieldsanswersinstitutename: "E. E. Vagner",
fieldsanswerrinstitutetype: "Escola", fieldsanswerrinstitutetype: "Escola",
}, },
], ],

2
src/app/screens/LoginScreen.js

@ -78,7 +78,7 @@ export default function LoginScreen(props) {
const handleSubmit = async (name, password, setLoginFailed) => { const handleSubmit = async (name, password, setLoginFailed) => {
const result = await authApi.login(name, password); const result = await authApi.login(name, password);
console.log(result.ok);
// console.log(result.ok);
if (!result.ok) return setLoginFailed(true); if (!result.ok) return setLoginFailed(true);
setLoginFailed(false); setLoginFailed(false);

29
src/app/screens/RainSharingDataScreen.js

@ -57,15 +57,17 @@ function RainSharingDataScreen(props) {
setError(true); setError(true);
return; return;
} }
AssembleIngestionObject({
...values,
AssembleIngestionObject(
{
...values,
},
rainSituation, rainSituation,
code, code,
location, location,
date, date,
time, time,
address,
});
address
);
// insertRainData({ ...values, rain, location, date, time, address }); // insertRainData({ ...values, rain, location, date, time, address });
showMessage({ showMessage({
message: "Informação enviada!", message: "Informação enviada!",
@ -91,13 +93,19 @@ function RainSharingDataScreen(props) {
> >
<SvgLabeledButton <SvgLabeledButton
style={{ marginRight: 17 }} style={{ marginRight: 17 }}
onPress={() => {setRain(0); setRainSituation("SEM CHUVA")}}
onPress={() => {
setRain(0);
setRainSituation("SEM CHUVA");
}}
SvgImage={assets.rainLevel.Rain_0_5} SvgImage={assets.rainLevel.Rain_0_5}
label={"SEM CHUVA"} label={"SEM CHUVA"}
isToggle={rain == 0} isToggle={rain == 0}
/> />
<SvgLabeledButton <SvgLabeledButton
onPress={() => {setRain(1); setRainSituation("CHUVA FRACA")}}
onPress={() => {
setRain(1);
setRainSituation("CHUVA FRACA");
}}
SvgImage={assets.rainLevel.Rain_1_5} SvgImage={assets.rainLevel.Rain_1_5}
label={"CHUVA FRACA"} label={"CHUVA FRACA"}
isToggle={rain == 1} isToggle={rain == 1}
@ -107,14 +115,19 @@ function RainSharingDataScreen(props) {
<View flexDirection="row" justifyContent="center"> <View flexDirection="row" justifyContent="center">
<SvgLabeledButton <SvgLabeledButton
style={{ marginRight: 17 }} style={{ marginRight: 17 }}
onPress={() => {setRain(2); setRainSituation("CHUVA MODERADA")}}
onPress={() => {
setRain(2);
setRainSituation("CHUVA MODERADA");
}}
SvgImage={assets.rainLevel.Rain_2_5} SvgImage={assets.rainLevel.Rain_2_5}
label={"CHUVA MODERADA"} label={"CHUVA MODERADA"}
isToggle={rain == 2} isToggle={rain == 2}
/> />
<SvgLabeledButton <SvgLabeledButton
onPress={() => {setRain(3), setRainSituation("CHUVA FORTE")}}
onPress={() => {
setRain(3), setRainSituation("CHUVA FORTE");
}}
SvgImage={assets.rainLevel.Rain_3_5} SvgImage={assets.rainLevel.Rain_3_5}
label={"CHUVA FORTE"} label={"CHUVA FORTE"}
isToggle={rain == 3} isToggle={rain == 3}

10
src/app/screens/RiverFloodSharingDataScreen.js

@ -60,15 +60,17 @@ function RiverFloodSharingDataScreen(props) {
return; return;
} }
// insertRiverData({ ...values, riverScale, location, date, time, address,}); // insertRiverData({ ...values, riverScale, location, date, time, address,});
AssembleIngestionObject({
...values,
AssembleIngestionObject(
{
...values,
},
riverSituation, riverSituation,
code, code,
location, location,
date, date,
time, time,
address,
});
address
);
showMessage({ showMessage({
message: "Informação enviada!", message: "Informação enviada!",
duration: 1950, duration: 1950,

10
src/app/screens/SharingFloodZonesScreen.js

@ -58,15 +58,17 @@ function SharingFloodZonesScreen(props) {
return; return;
} }
//insertFloodZone({ ...values, passable, location, date, time, address, }); //insertFloodZone({ ...values, passable, location, date, time, address, });
AssembleIngestionObject({
...values,
AssembleIngestionObject(
{
...values,
},
floodSituation, floodSituation,
code, code,
location, location,
date, date,
time, time,
address,
});
address
);
showMessage({ showMessage({
message: "Informação enviada!", message: "Informação enviada!",
duration: 1950, duration: 1950,

11
src/package-lock.json

@ -16712,6 +16712,11 @@
"point-in-polygon": "^1.0.1" "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": { "react-native-flash-message": {
"version": "0.1.18", "version": "0.1.18",
"resolved": "https://registry.npmjs.org/react-native-flash-message/-/react-native-flash-message-0.1.18.tgz", "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": { "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": { "requires": {
"invariant": ">=2" "invariant": ">=2"
} }

Loading…
Cancel
Save