@vue-skuilder/edit-ui 0.2.32 → 0.2.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.2.32",
6
+ "version": "0.2.34",
7
7
  "main": "./dist/edit-ui.umd.js",
8
8
  "module": "./dist/edit-ui.es.js",
9
9
  "types": "./dist/index.d.ts",
@@ -31,10 +31,10 @@
31
31
  "cypress:run": "cypress run --component"
32
32
  },
33
33
  "dependencies": {
34
- "@vue-skuilder/common": "0.2.32",
35
- "@vue-skuilder/common-ui": "0.2.32",
36
- "@vue-skuilder/courseware": "0.2.32",
37
- "@vue-skuilder/db": "0.2.32",
34
+ "@vue-skuilder/common": "0.2.34",
35
+ "@vue-skuilder/common-ui": "0.2.34",
36
+ "@vue-skuilder/courseware": "0.2.34",
37
+ "@vue-skuilder/db": "0.2.34",
38
38
  "pinia": "^2.3.0",
39
39
  "vue": "^3.5.13",
40
40
  "vuetify": "^3.7.0"
@@ -65,5 +65,5 @@
65
65
  "vite": "^8.0.0",
66
66
  "vitest": "^4.1.0"
67
67
  },
68
- "stableVersion": "0.2.32"
68
+ "stableVersion": "0.2.34"
69
69
  }
@@ -22,6 +22,7 @@
22
22
  <v-btn v-if="!question.registered" size="small" @click="registerQuestionView(question.name)"> Register </v-btn>
23
23
  <span v-else class="inset"> (Registered) </span>
24
24
  {{ question.name }}
25
+ <span v-if="question.seedProgress" class="inset">{{ question.seedProgress }}</span>
25
26
  </li>
26
27
  </ul>
27
28
  </div>
@@ -39,6 +40,8 @@ import {
39
40
  DataShape55,
40
41
  QuestionType55,
41
42
  DataShape,
43
+ Status,
44
+ toCourseElo,
42
45
  } from '@vue-skuilder/common';
43
46
  import * as _ from 'lodash';
44
47
  import { getCurrentUser } from '@vue-skuilder/common-ui';
@@ -55,6 +58,7 @@ export interface QuestionRegistrationStatus {
55
58
  course: string;
56
59
  question: typeof Displayable;
57
60
  registered: boolean;
61
+ seedProgress?: string;
58
62
  }
59
63
 
60
64
  export default defineComponent({
@@ -209,9 +213,29 @@ CourseID: ${this.course}
209
213
  `);
210
214
  if (question.question.seedData) {
211
215
  console.log(`[ComponentRegistration] Question has seed data!`);
212
- question.question.seedData.forEach((d) => {
213
- this.courseDB!.addNote(question.course, question.question.dataShapes[0], d, u.getUsername(), []);
214
- });
216
+ // One note at a time: notes sharing a tag would race on the tag doc, and a lost
217
+ // tag write aborts the note's remaining cards.
218
+ const seeds = question.question.seedData;
219
+ let failed = 0;
220
+ for (let i = 0; i < seeds.length; i++) {
221
+ question.seedProgress = `seeding ${i + 1}/${seeds.length}`;
222
+ const meta = question.question.seedMeta?.(seeds[i]) ?? {};
223
+ const res = await this.courseDB!.addNote(
224
+ question.course,
225
+ question.question.dataShapes[0],
226
+ seeds[i],
227
+ u.getUsername(),
228
+ meta.tags ?? [],
229
+ undefined,
230
+ meta.elo !== undefined ? toCourseElo(meta.elo) : undefined
231
+ );
232
+ if (res.status !== Status.ok) {
233
+ failed++;
234
+ console.error(`[ComponentRegistration] Seed ${i} failed: ${res.message}`);
235
+ }
236
+ }
237
+ question.seedProgress =
238
+ `seeded ${seeds.length - failed}/${seeds.length}` + (failed ? ` (${failed} failed)` : '');
215
239
  } else {
216
240
  console.log(`[ComponentRegistration] Question has NO seed data!`);
217
241
  }