- commit
- 259ad59
- parent
- 91ab94d
- author
- Neale Pickett
- date
- 2024-04-17 17:17:58 -0600 MDT
Fix bug with solved puzzle tracking
4 files changed,
+25,
-12
+4,
-0
1@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
2 The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
3 and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
4
5+## [v4.6.1] - 2024-04-17
6+### Changed
7+- Fixed bug with solved puzzle tracking when config.json cannot be loaded.
8+
9 ## [v4.6.0] - 2024-04-17
10 ### Changed
11 - Mothd now correctly handles using the current directory for a path.
+16,
-9
1@@ -48,7 +48,7 @@ function WhenDOMLoaded(cb) {
2 * @param {String} s
3 * @returns {Boolean}
4 */
5-function Truthy(s) {
6+function StringTruthy(s) {
7 switch (s.toLowerCase()) {
8 case "disabled":
9 case "no":
10@@ -66,13 +66,20 @@ function Truthy(s) {
11 * @returns {Promise.<Object>}
12 */
13 async function Config() {
14- let resp = await fetch(
15- new URL("config.json", BaseURL),
16- {
17- cache: "no-cache"
18- },
19- )
20- return resp.json()
21+ let obj = {}
22+ try {
23+ let resp = await fetch(
24+ new URL("configg.json", BaseURL),
25+ {
26+ cache: "no-cache"
27+ },
28+ )
29+ obj = await resp.json()
30+ }
31+ catch(err) {
32+ obj = {}
33+ }
34+ return obj
35 }
36
37 export {
38@@ -83,6 +90,6 @@ export {
39 BaseURL,
40 Toast,
41 WhenDOMLoaded,
42- Truthy,
43+ StringTruthy,
44 Config,
45 }
+1,
-1
1@@ -29,7 +29,7 @@
2 Solved puzzle tracking: <b>disabled</b>.
3 </p>
4 <p>
5- Your team's Incident Coordinator can help coordinate team activity.
6+ To avoid duplication of work, your team should coordinate.
7 </p>
8 </div>
9
+4,
-2
1@@ -92,8 +92,10 @@ class App {
2
3 // Update elements with data-track-solved
4 for (let e of document.querySelectorAll("[data-track-solved]")) {
5- // Only display if data-track-solved is the same as config.trackSolved
6- e.classList.toggle("hidden", common.Truthy(e.dataset.trackSolved) != this.config.PuzzleList?.TrackSolved)
7+ // Only hide if data-track-solved is different than config.PuzzleList.TrackSolved
8+ let tracking = this.config.PuzzleList?.TrackSolved || false
9+ let displayIf = common.StringTruthy(e.dataset.trackSolved)
10+ e.classList.toggle("hidden", tracking != displayIf)
11 }
12
13 for (let e of document.querySelectorAll(".login")) {