From 58918758827c0884ea909c0027298f788862902e Mon Sep 17 00:00:00 2001 From: tree Date: Mon, 30 May 2022 14:32:33 +0200 Subject: [PATCH] Update --- src/lib/api.js | 4 ++++ src/routes/seznam-udalosti.svelte | 23 +++++++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/src/lib/api.js b/src/lib/api.js index dc851ba..0bc88e8 100644 --- a/src/lib/api.js +++ b/src/lib/api.js @@ -37,6 +37,10 @@ class API { description: sp.desc } }) + const schedule = this.bundle.schedule.find(s => s.event === ev.id) + if (schedule) { + ev.scheduleId = '@' + schedule.id + } } } return this.bundle diff --git a/src/routes/seznam-udalosti.svelte b/src/routes/seznam-udalosti.svelte index b2e1918..c603f95 100644 --- a/src/routes/seznam-udalosti.svelte +++ b/src/routes/seznam-udalosti.svelte @@ -106,13 +106,23 @@ arr = arr.filter((e) => e.track === f.key); } if (f.type === "text") { - const sr = fuse.search(f.key); - if (sr.length > 0) { - arr = sr - .map((sr) => arr.find((i) => i.id === sr.item.id)) - .filter((sr) => sr); + if (f.key.substring(0,1) === '@') { + const schedule = bd.spec.schedule.find(e => e.id === f.key.substring(1)) + if (schedule) { + const ev = bd.spec.events.find(e => e.id === schedule.event) + arr = [ev]; + } else { + arr = []; + } } else { - arr = []; + const sr = fuse.search(f.key); + if (sr.length > 0) { + arr = sr + .map((sr) => arr.find((i) => i.id === sr.item.id)) + .filter((sr) => sr); + } else { + arr = []; + } } } } @@ -126,6 +136,7 @@ //minMatchCharLength: 1, threshold: 0.4, keys: [ + { name: "scheduleId", weight: 20 }, { name: "name", weight: 10 }, { name: "description", weight: 7 }, { name: "speakers", weight: 5 },