MCPcopy Create free account
hub / github.com/0010aor/FlashNotes / calculateAverageAccuracy

Function calculateAverageAccuracy

frontend/src/utils/stats.ts:3–12  ·  view source on GitHub ↗
(
  sessions: PracticeSessionStats[] | undefined,
)

Source from the content-addressed store, hash-verified

1import type { PracticeSessionStats } from '@/client'
2
3export const calculateAverageAccuracy = (
4 sessions: PracticeSessionStats[] | undefined,
5): number | null => {
6 if (!sessions || sessions.length === 0) return null
7
8 const totalCorrect = sessions.reduce((sum, session) => sum + session.correct_answers, 0)
9 const totalPracticed = sessions.reduce((sum, session) => sum + session.cards_practiced, 0)
10
11 return totalPracticed > 0 ? Math.round((totalCorrect / totalPracticed) * 100) : null
12}
13
14export const calculateSessionSuccessRate = (
15 session: PracticeSessionStats | null,

Callers 1

StatsSummaryGridFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected