MCPcopy
hub / github.com/codeaashu/claude-code / calculatePercentiles

Function calculatePercentiles

src/utils/heatmap.ts:19–34  ·  view source on GitHub ↗

* Pre-calculates percentiles from activity data for use in intensity calculations

(
  dailyActivity: DailyActivity[],
)

Source from the content-addressed store, hash-verified

17 * Pre-calculates percentiles from activity data for use in intensity calculations
18 */
19function calculatePercentiles(
20 dailyActivity: DailyActivity[],
21): Percentiles | null {
22 const counts = dailyActivity
23 .map(a => a.messageCount)
24 .filter(c => c > 0)
25 .sort((a, b) => a - b)
26
27 if (counts.length === 0) return null
28
29 return {
30 p25: counts[Math.floor(counts.length * 0.25)]!,
31 p50: counts[Math.floor(counts.length * 0.5)]!,
32 p75: counts[Math.floor(counts.length * 0.75)]!,
33 }
34}
35
36/**
37 * Generates a GitHub-style activity heatmap for the terminal

Callers 1

generateHeatmapFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected