Skip to content

Commit

Permalink
feature: percentil da criança (gráfico não tá funcionando)
Browse files Browse the repository at this point in the history
  • Loading branch information
caduvt committed Feb 20, 2025
1 parent 8103d70 commit ea8eb5a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
4 changes: 1 addition & 3 deletions src/screens/ChildFollowUp/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import * as S from './styles';
import React, { useContext, useEffect, useState } from 'react';
import React from 'react';
import AmbientCard from '@components/AmbientCard';
import { View, TouchableOpacity } from 'react-native';
import Ionicons from '@expo/vector-icons/Ionicons';
import Bebe from '@assets/icons/Bebe.png';
import Seringa from '@assets/icons/Seringa.png';
import Graph from '@assets/icons/Graph.png';
import Trophy from '@assets/icons/Trophy.png';
import ReminderCard from '@components/ReminderCard';
import { useChildContext } from '@hooks/useChild';
import ChildrenHeader from '@components/ChildrenHeader';
import ChildCard from '@components/ChildCard';
Expand Down
13 changes: 5 additions & 8 deletions src/screens/CurvaDeCrescimento/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,16 @@ const ChildGrowthScreen = ({ navigation }) => {
}

const findClosestPercentile = () => {
const genderData = datasets[child.gender]?.[curveType];
const genderData = datasets[child.gender][selectedCurveType];
if (!genderData) return "N/A";

const latestData = growthData[growthData.length - 1];
console.log("data mais recente -> ", latestData);

const measure = () => {
switch (curveType) {
case 'Estatura (cm)': return Number(latestData.height);
case 'Peso (kg)': return Number(latestData.weight);
case 'IMC': return Number(latestData.imc);
case 'Estatura (cm)': return latestData.height;
case 'Peso (kg)': return latestData.weight;
case 'IMC': return latestData.imc;
}
}

Expand Down Expand Up @@ -106,7 +105,6 @@ const ChildGrowthScreen = ({ navigation }) => {
point[percentile] = Number.parseFloat(genderData[percentile][index][percentile.toLowerCase()].replace(',', '.'));
});
dataPoints.push(point);
console.log(dataPoints);
});

return dataPoints;
Expand Down Expand Up @@ -203,8 +201,7 @@ const ChildGrowthScreen = ({ navigation }) => {
}
}
fetchData();
console.log(childData);
}, [child, selectedCurveType, curveType]);
}, [child, selectedCurveType, curveType]);

const legendData = percentiles.map((percentile, index) => ({
label: percentile,
Expand Down
8 changes: 4 additions & 4 deletions src/screens/EditCurve/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,17 @@ const EditCurveScreen = ({ navigation }) => {
setGrowthData(sortedData);
}

function onInsertClose(data: RowData) {
async function onInsertClose(data: RowData) {
(async () => {
await GrowthDataService.create({
childrenId: activeChild.idchildren,
weight: Number(data.weight),
height: Number(data.height),
growthDate: data.growthDate
});
await fetchData();
setInsertModal(false);
})();
fetchData();
setInsertModal(false);
}

async function onDelete() {
Expand All @@ -89,7 +89,7 @@ const EditCurveScreen = ({ navigation }) => {
},
selectedRow.id
);
fetchData();
await fetchData();
setEditModal(false);
})();
}
Expand Down

0 comments on commit ea8eb5a

Please sign in to comment.