|
|
@@ -1885,9 +1885,10 @@ export class LearningPageComponent implements OnInit, OnDestroy {
|
|
|
}
|
|
|
|
|
|
private saveLessonBatch(mode: 'draft' | 'open-draft' | 'confirm' | 'mastery', words: Word[]): Observable<LessonBatchResult> {
|
|
|
- const batchId = String(this.storageGet('batchId') || crypto.randomUUID());
|
|
|
- this.storageSet('batchId', batchId);
|
|
|
- const version = Number(this.storageGet('batchVersion') || 0);
|
|
|
+ const opening = mode === 'open-draft';
|
|
|
+ const batchId = opening ? crypto.randomUUID() : String(this.storageGet('batchId') || crypto.randomUUID());
|
|
|
+ const version = opening ? 0 : Number(this.storageGet('batchVersion') || 0);
|
|
|
+ if (!opening) this.storageSet('batchId', batchId);
|
|
|
const xxqs = words.map(w => ({GeneralID: w.wordId, Title: w.word, check: mode === 'confirm' || mode === 'mastery' ? this.reviewValue(w) : 0}));
|
|
|
return this.api.post<LessonBatchResult>('stu_record_update_v2', {
|
|
|
orderId: this.query('orderId') || this.query('id'), uid: this.session.student()?.userId,
|
|
|
@@ -1895,6 +1896,7 @@ export class LearningPageComponent implements OnInit, OnDestroy {
|
|
|
requestKey: this.draft().command('batch:' + batchId + ':' + version + ':' + mode + ':' + JSON.stringify(xxqs)),
|
|
|
addon: JSON.stringify({bindingId: this.query('bindingId'), xxqs}),
|
|
|
}).pipe(map(({result}) => {
|
|
|
+ if (opening && !result.resumed) this.clearLearningStorage();
|
|
|
this.storageSet('batchId', result.batchId || batchId);
|
|
|
this.storageSet('batchVersion', result.batchVersion);
|
|
|
if (result.learned !== undefined) this.lessonLearnedCount.set(Number(result.learned));
|
|
|
@@ -2241,7 +2243,6 @@ export class LearningPageComponent implements OnInit, OnDestroy {
|
|
|
|
|
|
private beginSelectedFlow(chosen: Word[], mode: '' | 'newword' | 'history_word'): void {
|
|
|
if (this.query('orderId') && !mode) {
|
|
|
- this.clearLearningStorage();
|
|
|
this.submitting.set(true);
|
|
|
this.saveLessonBatch('open-draft', chosen).pipe(finalize(() => this.submitting.set(false))).subscribe({
|
|
|
next: result => {
|