Umami is a privacy-first web and product analytics platform. Traffic, campaigns, behavior, conversions, and revenue in one place. No cookies, no surveillance, self-hosted or in the cloud.
TypeScript analyticsaudience-segmentationchartscohort-analysisgoogle-analyticsproduct-analyticsstatisticsuser-journeyweb-analytics
Fix percentages.
Brian Cao4d66d400a949
diff --git a/src/app/(main)/reports/goals/GoalsChart.tsx b/src/app/(main)/reports/goals/GoalsChart.tsxindex 7cebbe217..f20c4f9b3 100644--- a/src/app/(main)/reports/goals/GoalsChart.tsx+++ b/src/app/(main)/reports/goals/GoalsChart.tsx@@ -33,10 +33,13 @@ export function GoalsChart({ className }: { className?: string; isLoading?: bool<span className={styles.visitors}>{formatLongNumber(goal)}</span>{formatMessage(labels.goal)}</div>- <div className={styles.percent}>{(result / goal).toFixed(2)}%</div>+ <div className={styles.percent}>{((result / goal) * 100).toFixed(2)}%</div></div><div className={styles.track}>- <div className={styles.bar} style={{ width: `${result / goal}%` }}></div>+ <div+ className={styles.bar}+ style={{ width: `${result > goal ? 100 : (result / goal) * 100}%` }}+ ></div></div></div></div>diff --git a/src/queries/analytics/reports/getGoals.ts b/src/queries/analytics/reports/getGoals.tsindex f275d6046..d26998d03 100644--- a/src/queries/analytics/reports/getGoals.ts+++ b/src/queries/analytics/reports/getGoals.ts@@ -196,7 +196,7 @@ async function clickhouseQuery(const results = a[0];return Object.keys(results).map((key, i) => {- return { ...urls[i], result: results[key] };+ return { ...urls[i], goal: Number(urls[i].goal), result: Number(results[key]) };});}): [];@@ -216,7 +216,7 @@ async function clickhouseQuery(const results = a[0];return Object.keys(results).map((key, i) => {- return { ...events[i], result: results[key] };+ return { ...events[i], goal: Number(events[i].goal), result: Number(results[key]) };});}): [];