Browse Source

preventing error when trying to retrive PLUVIOMETER_FORM data

master
analuizaff 3 years ago
parent
commit
c07dc26149
  1. 2
      src/app/assets/pluviometer/pluviometer-logo.svg
  2. 8
      src/app/components/AssembleModalObject.js
  3. 13
      src/app/components/MapModal.js

2
src/app/assets/pluviometer/pluviometer-logo.svg

@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="150" height="140" viewBox="0 0 150 140"><g id="b61690fe-17b8-491c-bd67-2dcddc2c6756" data-name="Camada 1"><rect x="61.2" y="31.69" width="27.54" height="102.74" fill="#ececec"/><path d="M91.31,137H58.64V29.12H91.31Zm-27.54-5.13h22.4V34.26H63.77Z" fill="#3b7097"/><rect x="63.13" y="30.56" width="11.95" height="103.42" fill="#d9d9d9"/><path d="M62.53,105.68l1.09-2.05c4.32-2.66,5.51-4,9.36-1.16.34.26.68.51,1,.74l2.84,2.06c2.68,2.15,5-.31,5.72-.89l2.87-2.17a2,2,0,0,1,3.19,1.53v27.71a2,2,0,0,1-1.88,2l-22.1,1a2,2,0,0,1-2-1.88l-1-25.06A1.94,1.94,0,0,1,62.53,105.68Z" fill="#9fdfff"/><path d="M75.07,104l-1-.75c-.37-.23-.71-.48-1-.74-3.85-2.86-5-1.5-9.36,1.16l-1.09,2.05a1.94,1.94,0,0,0-.93,1.75l1,25.06a2,2,0,0,0,2,1.88l10.4-.45Z" fill="#7dd6f9"/><path d="M91.31,137H58.64V29.12H91.31Zm-27.54-5.13h22.4V34.26H63.77Z" fill="#727272"/><path d="M42.45,5.57h65.09a0,0,0,0,1,0,0V8.73A21.71,21.71,0,0,1,85.84,30.45H64.16A21.71,21.71,0,0,1,42.45,8.73V5.57A0,0,0,0,1,42.45,5.57Z" fill="#ececec"/><path d="M82.91,33H67.09a27.23,27.23,0,0,1-27.2-27.2V3h70.22V5.81A27.23,27.23,0,0,1,82.91,33ZM45.14,8.13a22.1,22.1,0,0,0,22,19.75H82.91a22.1,22.1,0,0,0,22-19.75Z" fill="#3b7097"/><path d="M45,5.5H74.9a0,0,0,0,1,0,0V30.56a0,0,0,0,1,0,0h-8A21.87,21.87,0,0,1,45,8.69V5.5A0,0,0,0,1,45,5.5Z" fill="#d9d9d9"/><path d="M82.91,33H67.09a27.23,27.23,0,0,1-27.2-27.2V3h70.22V5.81A27.23,27.23,0,0,1,82.91,33ZM45.14,8.13a22.1,22.1,0,0,0,22,19.75H82.91a22.1,22.1,0,0,0,22-19.75Z" fill="#727272"/><rect x="58.91" y="53.81" width="19.68" height="2.05" fill="#727272"/><rect x="58.91" y="67.94" width="19.68" height="2.05" fill="#727272"/><rect x="58.91" y="82.07" width="19.68" height="2.05" fill="#727272"/><rect x="58.91" y="96.19" width="19.68" height="2.05" fill="#727272"/><rect x="58.91" y="110.32" width="19.68" height="2.05" fill="#727272"/></g></svg>
<svg id="bab5a78b-257c-45f5-80c9-095df1fdddb4" data-name="Camada 1" xmlns="http://www.w3.org/2000/svg" width="61" height="78" viewBox="0 0 305 390"><circle cx="153" cy="149.5" r="120.5" fill="#fff"/><path d="M152.5,4.64c-79.95,0-145,65.05-145,145a143.68,143.68,0,0,0,28.93,86.93L143.56,380.86c.27.35.68.48,1,.8a10.79,10.79,0,0,0,16.89-.8c30.85-41.16,87.4-118,109.14-147a.14.14,0,0,1,0,0l.13-.18a144,144,0,0,0,26.78-84C297.5,69.69,232.45,4.64,152.5,4.64Zm-.26,258.84c-62.79,0-114.1-51.32-114.1-114.1s51.31-114.1,114.1-114.1,114.09,51.31,114.09,114.1S215,263.48,152.24,263.48Z" fill="#3b7097"/><rect x="134.31" y="100.16" width="36.3" height="135.45" fill="#ececec"/><path d="M174,239H130.93V96.78H174Zm-36.3-6.77h29.53V103.55H137.7Z" fill="#3b7097"/><rect x="136.84" y="98.68" width="15.76" height="136.35" fill="#d9d9d9"/><path d="M136.06,197.7l1.44-2.7c5.69-3.5,7.27-5.29,12.33-1.52.46.33.91.67,1.39,1l3.74,2.72c3.54,2.83,6.58-.41,7.54-1.17l3.79-2.87a2.59,2.59,0,0,1,4.21,2v36.54a2.59,2.59,0,0,1-2.48,2.58l-29.13,1.26a2.58,2.58,0,0,1-2.7-2.48l-1.36-33A2.6,2.6,0,0,1,136.06,197.7Z" fill="#9fdfff"/><path d="M152.59,195.44l-1.37-1c-.48-.3-.93-.64-1.39-1-5.06-3.77-6.64-2-12.33,1.52l-1.44,2.7a2.6,2.6,0,0,0-1.23,2.32l1.36,33a2.58,2.58,0,0,0,2.7,2.48l13.7-.59Z" fill="#7dd6f9"/><path d="M174,239H130.93V96.78H174Zm-36.3-6.77h29.53V103.55H137.7Z" fill="#727272"/><path d="M109.59,65.72h85.82a0,0,0,0,1,0,0V69.9a28.62,28.62,0,0,1-28.62,28.62H138.22A28.62,28.62,0,0,1,109.59,69.9V65.72a0,0,0,0,1,0,0Z" fill="#ececec"/><path d="M162.93,101.91H142.07a35.9,35.9,0,0,1-35.86-35.86V62.34h92.58v3.71A35.9,35.9,0,0,1,162.93,101.91Zm-49.79-32.8a29.12,29.12,0,0,0,28.93,26h20.86a29.12,29.12,0,0,0,28.93-26Z" fill="#3b7097"/><path d="M113,65.63h39.36a0,0,0,0,1,0,0v33a0,0,0,0,1,0,0H141.84A28.84,28.84,0,0,1,113,69.84V65.63A0,0,0,0,1,113,65.63Z" fill="#d9d9d9"/><path d="M162.93,101.91H142.07a35.9,35.9,0,0,1-35.86-35.86V62.34h92.58v3.71A35.9,35.9,0,0,1,162.93,101.91Zm-49.79-32.8a29.12,29.12,0,0,0,28.93,26h20.86a29.12,29.12,0,0,0,28.93-26Z" fill="#727272"/><rect x="131.29" y="129.33" width="25.94" height="2.71" fill="#727272"/><rect x="131.29" y="147.95" width="25.94" height="2.71" fill="#727272"/><rect x="131.29" y="166.58" width="25.94" height="2.71" fill="#727272"/><rect x="131.29" y="185.2" width="25.94" height="2.71" fill="#727272"/><rect x="131.29" y="203.83" width="25.94" height="2.71" fill="#727272"/></svg>

8
src/app/components/AssembleModalObject.js

@ -4,7 +4,7 @@ import { View, Text } from "react-native";
import assets from "../config/assets";
const custom_assets = {
pluviometer: assets.pluviometer,
pluviometer: assets.PluviometerIcon,
officialPluviometer: assets.OfficialPluviometer,
floodZones: assets.floodZones,
riverLevel: ["Low", "Normal", "High", "Flooding"].map((key) => {
@ -66,7 +66,7 @@ function verifyMeasureDates(labels, measureDate) {
}
const AssembleModalObject = (response, name) => {
console.log(response);
//console.log(response);
var situation = null;
var user = null;
var institution = null;
@ -82,7 +82,6 @@ const AssembleModalObject = (response, name) => {
if (JSON.parse(response).array_to_json) {
const r = JSON.parse(response).array_to_json;
console.log(response);
//(waiting for issue #16) user = r[0].formsanswersuserinformer;
@ -105,6 +104,9 @@ const AssembleModalObject = (response, name) => {
address = f.fieldsanswersvalue;
}
});
} else if (name == "pluviometer") {
situation = "PLUVIÔMETRO";
//buscar todos os PLUVIOMETERS_FORMS REPORTADOS PELO USUÁRIO DOS ULTIMOS 5 DIAS
} else {
if (r[0].array_to_json) {
user = r[0].formsanswersuserinformer;

13
src/app/components/MapModal.js

@ -28,14 +28,6 @@ function notImplemented() {
});
}
function loadingData() {
return (
<View>
<Text>Carregando dados...</Text>
</View>
);
}
function onCloseModal(setShowModal, setCurrentMarker) {
setShowModal(null);
setCurrentMarker(undefined);
@ -282,8 +274,7 @@ function MapModal({ showModal, setShowModal, markers }) {
var timeFilter = null;
const getAnswers = async (id, name) => {
// console.log("----------id:"+id);
if (isPluviometer(name)) {
if (isOfficialPluviometer(name)) {
const initialDate = moment().format("YYYY-MM-DD");
const finalDate = moment().subtract(5, "days").format("YYYY-MM-DD");
@ -294,6 +285,8 @@ function MapModal({ showModal, setShowModal, markers }) {
const result = await getFieldsAnswers.fieldsAnswers(timeFilter, id);
if (result.data && showModal && currentMarker == undefined) {
setCurrentMarker(
AssembleModalObject(
JSON.stringify(result.data.responseData),

Loading…
Cancel
Save