( collectionId: string, totalCards: number, now: number, )
| 33 | } |
| 34 | |
| 35 | async function createPracticeSession( |
| 36 | collectionId: string, |
| 37 | totalCards: number, |
| 38 | now: number, |
| 39 | ): Promise<LocalPracticeSession> { |
| 40 | const newSession: LocalPracticeSession = { |
| 41 | id: uuidv4(), |
| 42 | collectionId, |
| 43 | startedAt: now, |
| 44 | isCompleted: false, |
| 45 | totalCards, |
| 46 | cardsPracticed: 0, |
| 47 | correctAnswers: 0, |
| 48 | createdAt: now, |
| 49 | updatedAt: now, |
| 50 | synced: false, |
| 51 | } |
| 52 | await db.practice_sessions.add(newSession) |
| 53 | return newSession |
| 54 | } |
| 55 | |
| 56 | async function createPracticeCardsForSession(sessionId: string, cards: LocalCard[]) { |
| 57 | const practiceCards: LocalPracticeCard[] = cards.map((card) => ({ |
no outgoing calls
no test coverage detected