Browse Source

fixing a ingestion issue

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

19
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,10 +70,10 @@ 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",

2
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);

27
src/app/screens/RainSharingDataScreen.js

@ -57,15 +57,17 @@ function RainSharingDataScreen(props) {
setError(true);
return;
}
AssembleIngestionObject({
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) {
>
<SvgLabeledButton
style={{ marginRight: 17 }}
onPress={() => {setRain(0); setRainSituation("SEM CHUVA")}}
onPress={() => {
setRain(0);
setRainSituation("SEM CHUVA");
}}
SvgImage={assets.rainLevel.Rain_0_5}
label={"SEM CHUVA"}
isToggle={rain == 0}
/>
<SvgLabeledButton
onPress={() => {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) {
<View flexDirection="row" justifyContent="center">
<SvgLabeledButton
style={{ marginRight: 17 }}
onPress={() => {setRain(2); setRainSituation("CHUVA MODERADA")}}
onPress={() => {
setRain(2);
setRainSituation("CHUVA MODERADA");
}}
SvgImage={assets.rainLevel.Rain_2_5}
label={"CHUVA MODERADA"}
isToggle={rain == 2}
/>
<SvgLabeledButton
onPress={() => {setRain(3), setRainSituation("CHUVA FORTE")}}
onPress={() => {
setRain(3), setRainSituation("CHUVA FORTE");
}}
SvgImage={assets.rainLevel.Rain_3_5}
label={"CHUVA FORTE"}
isToggle={rain == 3}

8
src/app/screens/RiverFloodSharingDataScreen.js

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

8
src/app/screens/SharingFloodZonesScreen.js

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

11
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"
}

Loading…
Cancel
Save