From 18c986ba95453bbcea85d4051200ed1fd735bfe2 Mon Sep 17 00:00:00 2001 From: Klemek Date: Fri, 21 Feb 2025 19:46:54 +0100 Subject: [PATCH] small fix --- index.html | 10 +++++++--- main.js | 10 ++++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 2b376dc..a34b269 100644 --- a/index.html +++ b/index.html @@ -191,14 +191,17 @@
- Current topic: {{ showSelected ? selectedData.text : '???' }} + No more topics + Current topic: {{ showSelected ? selectedData.text : '???' }}
@@ -238,7 +241,8 @@
-
Discuss the current topic
+
End of meeting?
+
Discuss the current topic
Enter your topics then click the wheel to spin !
diff --git a/main.js b/main.js index c05f080..9389a0b 100644 --- a/main.js +++ b/main.js @@ -72,6 +72,9 @@ let app = { } ); }, + noData() { + return this.filteredData.length === 0; + }, filteredData() { return this.data.filter((item) => !item.disabled); }, @@ -181,7 +184,7 @@ let app = { } }, spin() { - if (this.timerStarted) return; + if (this.timerStarted || this.noData) return; this.showSelected = false; if (this.initialSpin) { this.meetingStart = new Date(); @@ -195,8 +198,11 @@ let app = { }, 5000); }, getSelected() { + if (this.svgData.length <= 1) { + return 0; + } const angle = 360 - (this.wheelPosition % 360); - for (let index = 0; index < this.data.length; index++) { + for (let index = 0; index < this.svgData.length; index++) { const element = this.svgData[index]; if (angle >= element.from && angle < element.to) { return element.id;