@vue-skuilder/courseware 0.1.33-vite8-4 → 0.1.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/dist/index.mjs CHANGED
@@ -281,10 +281,22 @@ var ge = class BlanksCard extends B {
281
281
  this.name = e, this.questionList = t, this.questionList = this.questionList.concat(this.getBaseQTypes());
282
282
  }
283
283
  getQuestion(e) {
284
- return this.questionList.find((t) => {
285
- let n = t.name.replace(/^_/, "").replace(/\d+$/, ""), r = e.replace(/^_/, "").replace(/\d+$/, "");
286
- return t.name === e || n === r || t.name.includes(r) || e.includes(n);
284
+ let t = e.replace(/^_/, "").replace(/\d+$/, ""), n = this.questionList.map((e) => e.name), r = this.questionList.find((n) => {
285
+ let r = n.name.replace(/^_/, "").replace(/\d+$/, "");
286
+ return n.name === e || r === t;
287
287
  });
288
+ if (r) return r.name !== e && console.debug(`[CourseWare.getQuestion] stripped-exact: "${e}" → "${r.name}" (registered: ${n.join(", ")})`), r;
289
+ let a = this.questionList.filter((n) => {
290
+ let r = n.name.replace(/^_/, "").replace(/\d+$/, "");
291
+ return n.name.includes(t) || e.includes(r);
292
+ });
293
+ if (a.length === 0) {
294
+ console.warn(`[CourseWare.getQuestion] NO MATCH: "${e}" (base: "${t}") not found in [${n.join(", ")}]`);
295
+ return;
296
+ }
297
+ a.sort((t, n) => Math.abs(t.name.length - e.length) - Math.abs(n.name.length - e.length));
298
+ let o = a[0];
299
+ return console.warn(`[CourseWare.getQuestion] FUZZY: "${e}" → "${o.name}" (candidates: ${a.map((e) => e.name).join(", ")}; registered: ${n.join(", ")})`), o;
288
300
  }
289
301
  getBaseQTypes() {
290
302
  return [ge];