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

Function getLocalCollectionStats

frontend/src/data/localDB/stats.ts:5–31  ·  view source on GitHub ↗
(collectionId: string)

Source from the content-addressed store, hash-verified

3import * as practiceSessions from './practiceSessions'
4
5export async function getLocalCollectionStats(collectionId: string) {
6 const collection = await collections.getLocalCollectionById(collectionId)
7 const cardList = await cards.getLocalCardsForCollection(collectionId, 5)
8 const sessionList = await practiceSessions.getLocalPracticeSessions(collectionId, 30)
9
10 return {
11 collection_info: {
12 name: collection?.name || '',
13 total_cards: cardList.length,
14 total_practice_sessions: sessionList.length,
15 },
16 recent_sessions: sessionList.map((s) => ({
17 id: s.id,
18 created_at: new Date(s.startedAt).toISOString(),
19 cards_practiced: s.cardsPracticed,
20 correct_answers: s.correctAnswers,
21 total_cards: s.totalCards,
22 is_completed: s.isCompleted,
23 })),
24 difficult_cards: cardList.map((card) => ({
25 id: card.id,
26 front: card.front,
27 total_attempts: 0,
28 correct_answers: 0,
29 })),
30 }
31}

Callers 1

getCollectionStatsMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected