File tree Expand file tree Collapse file tree
packages/web/src/ee/features/analytics Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -392,7 +392,9 @@ export function AnalyticsContent() {
392392
393393 const totalSavings = useMemo ( ( ) => {
394394 if ( ! analyticsResponse ) return 0
395- const totalOperations = analyticsResponse . reduce ( ( sum , row ) => sum + row . code_searches + row . navigations , 0 )
395+ // Only sum daily entries to avoid double-counting from overlapping time buckets
396+ const dailyEntries = analyticsResponse . filter ( row => row . period === "day" )
397+ const totalOperations = dailyEntries . reduce ( ( sum , row ) => sum + row . code_searches + row . navigations , 0 )
396398 const totalMinutesSaved = totalOperations * numericAvgMinutesSaved
397399 const hourlyRate = numericAvgSalary / ( 40 * 52 )
398400 return Math . round ( ( totalMinutesSaved / 60 * hourlyRate ) * 100 ) / 100
@@ -601,7 +603,7 @@ export function AnalyticsContent() {
601603 < p className = "text-sm text-muted-foreground mb-2" > Total Estimated Savings</ p >
602604 < p className = "text-3xl font-bold text-card-foreground" > ${ totalSavings . toLocaleString ( ) } </ p >
603605 < p className = "text-xs text-muted-foreground mt-1" >
604- Based on { analyticsResponse . reduce ( ( sum , row ) => sum + row . code_searches + row . navigations , 0 ) . toLocaleString ( ) } total operations
606+ Based on { dailyData . reduce ( ( sum , row ) => sum + row . code_searches + row . navigations , 0 ) . toLocaleString ( ) } total operations
605607 </ p >
606608 </ div >
607609 </ CardContent >
You can’t perform that action at this time.
0 commit comments