From a9acc6f216b5386fc26c4b9cd106380d2d21bf88 Mon Sep 17 00:00:00 2001 From: Brandon Presley Date: Thu, 15 Feb 2024 13:12:16 +1300 Subject: [PATCH] =?UTF-8?q?Undo=20NaN=20filtering=20for=20graphs=20-=202.2?= =?UTF-8?q?4=20=F0=9F=9A=80=20We=20published=20these=20changes,=20yet=20th?= =?UTF-8?q?e=20error=20was=20still=20occurring.=20Leaving=20this=20in=20ju?= =?UTF-8?q?st=20lowers=20performance=20for=20no=20value.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AppLineChart.tsx | 4 +--- AppPieChart.tsx | 2 +- ViewGraph.tsx | 8 +++----- android/app/build.gradle | 4 ++-- package.json | 4 ++-- 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/AppLineChart.tsx b/AppLineChart.tsx index 8b61a16..871dd85 100644 --- a/AppLineChart.tsx +++ b/AppLineChart.tsx @@ -19,8 +19,6 @@ export default function AppLineChart({ labels, data }: ChartProps) { color: () => colors.primary, }; - const validData = useMemo(() => data.map(d => isNaN(d) ? 0 : d), [data]) - const pruned = useMemo(() => { if (labels.length < 3) return labels; const newPruned = [labels[0]]; @@ -41,7 +39,7 @@ export default function AppLineChart({ labels, data }: ChartProps) { labels: pruned, datasets: [ { - data: validData, + data, }, ], }} diff --git a/AppPieChart.tsx b/AppPieChart.tsx index 38ecdcb..21479a1 100644 --- a/AppPieChart.tsx +++ b/AppPieChart.tsx @@ -23,7 +23,7 @@ export default function AppPieChart({ options }: { options: Option[] }) { const data = options.map((option, index) => ({ name: option.label, - value: isNaN(option.value) ? 0 : option.value, + value: option.value, color: pieChartColors[index], legendFontColor: colors.onSurface, legendFontSize: 15, diff --git a/ViewGraph.tsx b/ViewGraph.tsx index 21eb330..60330a6 100644 --- a/ViewGraph.tsx +++ b/ViewGraph.tsx @@ -36,11 +36,9 @@ export default function ViewGraph() { }, [])) const convertWeight = (weight: number, unitFrom: string, unitTo: string) => { - let result = weight; - if (unitFrom === unitTo) result = weight; - if (unitFrom === 'lb' && unitTo === 'kg') result = weight * 0.453592; - if (unitFrom === 'kg' && unitTo === 'lb') result = weight * 2.20462; - return isNaN(result) ? 0 : result; + if (unitFrom === unitTo) return weight + if (unitFrom === 'lb' && unitTo === 'kg') return weight * 0.453592; + if (unitFrom === 'kg' && unitTo === 'lb') return weight * 2.20462; }; useEffect(() => { diff --git a/android/app/build.gradle b/android/app/build.gradle index 89d488f..4cab15c 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -85,8 +85,8 @@ android { applicationId "com.massive" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 36238 - versionName "2.23" + versionCode 36239 + versionName "2.24" } signingConfigs { release { diff --git a/package.json b/package.json index 3c0b8ff..3c52213 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "massive", - "version": "2.23", + "version": "2.24", "private": true, "license": "GPL-3.0-only", "scripts": { @@ -71,4 +71,4 @@ "engines": { "node": ">=16" } -} +} \ No newline at end of file