* Initialize the study session with data from the server * @param {Object} sessionData - The session data from the API * @param {Function} updateCallback - Function to call when session state changes * @param {Object} deckSettings - The deck settings
(sessionData, updateCallback, deckSettings)
| 27 | * @param {Object} deckSettings - The deck settings |
| 28 | */ |
| 29 | initialize(sessionData, updateCallback, deckSettings) { |
| 30 | this.session = sessionData; |
| 31 | this.updateCallback = updateCallback; |
| 32 | this.cardIndex = 0; |
| 33 | this.deckSettings = deckSettings || { |
| 34 | steps: [1, 10, 60, 1440], // Default steps in minutes |
| 35 | newCardsPerDay: 20, |
| 36 | reviewsPerDay: 100 |
| 37 | }; |
| 38 | |
| 39 | if (sessionData && sessionData.deckId) { |
| 40 | this.deckId = sessionData.deckId; |
| 41 | } |
| 42 | |
| 43 | if (this.hasCards()) { |
| 44 | this.currentCard = this.session.cards[0]; |
| 45 | } |
| 46 | |
| 47 | return this.currentCard; |
| 48 | } |
| 49 | |
| 50 | /** |
| 51 | * Check if there are any cards to study |
no test coverage detected