Undo NaN filtering for graphs - 2.24 🚀

We published these changes, yet the error was still
occurring. Leaving this in just lowers performance
for no value.
This commit is contained in:
Brandon Presley 2024-02-15 13:12:16 +13:00
parent fd09758ccf
commit a9acc6f216
5 changed files with 9 additions and 13 deletions

View File

@ -19,8 +19,6 @@ export default function AppLineChart({ labels, data }: ChartProps) {
color: () => colors.primary, color: () => colors.primary,
}; };
const validData = useMemo(() => data.map(d => isNaN(d) ? 0 : d), [data])
const pruned = useMemo(() => { const pruned = useMemo(() => {
if (labels.length < 3) return labels; if (labels.length < 3) return labels;
const newPruned = [labels[0]]; const newPruned = [labels[0]];
@ -41,7 +39,7 @@ export default function AppLineChart({ labels, data }: ChartProps) {
labels: pruned, labels: pruned,
datasets: [ datasets: [
{ {
data: validData, data,
}, },
], ],
}} }}

View File

@ -23,7 +23,7 @@ export default function AppPieChart({ options }: { options: Option[] }) {
const data = options.map((option, index) => ({ const data = options.map((option, index) => ({
name: option.label, name: option.label,
value: isNaN(option.value) ? 0 : option.value, value: option.value,
color: pieChartColors[index], color: pieChartColors[index],
legendFontColor: colors.onSurface, legendFontColor: colors.onSurface,
legendFontSize: 15, legendFontSize: 15,

View File

@ -36,11 +36,9 @@ export default function ViewGraph() {
}, [])) }, []))
const convertWeight = (weight: number, unitFrom: string, unitTo: string) => { const convertWeight = (weight: number, unitFrom: string, unitTo: string) => {
let result = weight; if (unitFrom === unitTo) return weight
if (unitFrom === unitTo) result = weight; if (unitFrom === 'lb' && unitTo === 'kg') return weight * 0.453592;
if (unitFrom === 'lb' && unitTo === 'kg') result = weight * 0.453592; if (unitFrom === 'kg' && unitTo === 'lb') return weight * 2.20462;
if (unitFrom === 'kg' && unitTo === 'lb') result = weight * 2.20462;
return isNaN(result) ? 0 : result;
}; };
useEffect(() => { useEffect(() => {

View File

@ -85,8 +85,8 @@ android {
applicationId "com.massive" applicationId "com.massive"
minSdkVersion rootProject.ext.minSdkVersion minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 36238 versionCode 36239
versionName "2.23" versionName "2.24"
} }
signingConfigs { signingConfigs {
release { release {

View File

@ -1,6 +1,6 @@
{ {
"name": "massive", "name": "massive",
"version": "2.23", "version": "2.24",
"private": true, "private": true,
"license": "GPL-3.0-only", "license": "GPL-3.0-only",
"scripts": { "scripts": {
@ -71,4 +71,4 @@
"engines": { "engines": {
"node": ">=16" "node": ">=16"
} }
} }