@@ -60,32 +60,71 @@ export class ResponseProcessor {
6060 } ;
6161 }
6262
63- const history = await cardHistory ;
63+ // Debug logging for response processing
64+ // logger.debug('[ResponseProcessor] Processing response', {
65+ // cardId,
66+ // courseId,
67+ // isCorrect: cardRecord.isCorrect,
68+ // performance: cardRecord.performance,
69+ // priorAttempts: cardRecord.priorAttemps,
70+ // currentSessionViews: sessionViews,
71+ // maxSessionViews,
72+ // maxAttemptsPerView,
73+ // currentCardRecordsLength: currentCard.records.length,
74+ // studySessionSourceType: studySessionItem.contentSourceType,
75+ // studySessionSourceID: studySessionItem.contentSourceID,
76+ // studySessionItemId: studySessionItem.cardID,
77+ // studySessionItemType: studySessionItem.contentSourceType,
6478
65- // Handle correct responses
66- if ( cardRecord . isCorrect ) {
67- return this . processCorrectResponse (
68- cardRecord ,
69- history ,
70- studySessionItem ,
71- courseRegistrationDoc ,
72- currentCard ,
73- courseId ,
74- cardId
75- ) ;
76- } else {
77- // Handle incorrect responses
78- return this . processIncorrectResponse (
79- cardRecord ,
80- history ,
81- courseRegistrationDoc ,
82- currentCard ,
83- courseId ,
84- cardId ,
85- maxAttemptsPerView ,
86- maxSessionViews ,
87- sessionViews
88- ) ;
79+ // cardRecordTimestamp: cardRecord.timeStamp,
80+ // cardRecordResponseTime: cardRecord.timeSpent,
81+ // });
82+
83+ try {
84+ const history = await cardHistory ;
85+
86+ // Debug logging for card history
87+ // logger.debug('[ResponseProcessor] History loaded:', {
88+ // cardId,
89+ // historyRecordsCount: history.records.length,
90+ // historyRecords: history.records.map((record) => ({
91+ // timeStamp: record.timeStamp,
92+ // isCorrect: 'isCorrect' in record ? record.isCorrect : 'N/A',
93+ // performance: 'performance' in record ? record.performance : 'N/A',
94+ // priorAttempts: 'priorAttemps' in record ? record.priorAttemps : 'N/A',
95+ // })),
96+ // firstInteraction: history.records.length === 1,
97+ // lastRecord: history.records[history.records.length - 1],
98+ // });
99+
100+ // Handle correct responses
101+ if ( cardRecord . isCorrect ) {
102+ return this . processCorrectResponse (
103+ cardRecord ,
104+ history ,
105+ studySessionItem ,
106+ courseRegistrationDoc ,
107+ currentCard ,
108+ courseId ,
109+ cardId
110+ ) ;
111+ } else {
112+ // Handle incorrect responses
113+ return this . processIncorrectResponse (
114+ cardRecord ,
115+ history ,
116+ courseRegistrationDoc ,
117+ currentCard ,
118+ courseId ,
119+ cardId ,
120+ maxAttemptsPerView ,
121+ maxSessionViews ,
122+ sessionViews
123+ ) ;
124+ }
125+ } catch ( e : unknown ) {
126+ logger . error ( '[ResponseProcessor] Failed to load card history' , { e, cardId } ) ;
127+ throw e ;
89128 }
90129 }
91130
0 commit comments