MCPcopy Create free account
hub / github.com/JamesAC42/hanbok / updateSession

Method updateSession

app/src/lib/studySessionManager.js:102–121  ·  view source on GitHub ↗

* Update the session with new data from the server * @param {Object} updatedSession - The updated session data from the API * @returns {Object|null} The next card to study

(updatedSession)

Source from the content-addressed store, hash-verified

100 * @returns {Object|null} The next card to study
101 */
102 updateSession(updatedSession) {
103 this.session = updatedSession;
104 this.cardIndex = 0;
105
106 if (this.hasCards()) {
107 this.currentCard = this.session.cards[0];
108 } else {
109 this.currentCard = null;
110 }
111
112 if (this.updateCallback) {
113 this.updateCallback({
114 currentCard: this.currentCard,
115 cardIndex: this.cardIndex,
116 sessionUpdated: true
117 });
118 }
119
120 return this.currentCard;
121 }
122
123 /**
124 * Process a card rating and update its state according to SM-2

Callers

nothing calls this directly

Calls 1

hasCardsMethod · 0.95

Tested by

no test coverage detected