From f5e11d2e665f412d659e4ca7b714e9be663e26d7 Mon Sep 17 00:00:00 2001 From: David Vazgenovich Shakaryan Date: Wed, 20 Apr 2022 12:36:08 -0700 Subject: bust on 1 remaining; show bust in remaining bar --- web/static/dartboat.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'web/static') diff --git a/web/static/dartboat.js b/web/static/dartboat.js index b261f28..5eb3283 100644 --- a/web/static/dartboat.js +++ b/web/static/dartboat.js @@ -65,15 +65,20 @@ function promptSuggStr(str) { function promptUpdateRem() { let elem = document.getElementById('user-rem'); let pts = document.getElementById('prompt').textContent; - if (pts) - elem.textContent = `${user_rem} » ${user_rem - pts}`; - else + if (pts) { + let nrem = user_rem - pts; + let nrem_str = nrem < 0 || nrem == 1 ? "BUST" : nrem; + elem.textContent = `${user_rem} » ${nrem_str}`; + } else { elem.textContent = user_rem; + } } function boatTempRem(pts, str) { let elem = document.getElementById('boat-rem'); - elem.textContent = `${boat_rem - pts} « ${boat_rem}`; + let nrem = boat_rem - pts; + let nrem_str = nrem < 0 || nrem == 1 ? "BUST" : nrem; + elem.textContent = `${nrem_str} « ${boat_rem}`; document.getElementById('prompt').textContent = pts; promptSuggStr(str); -- cgit v1.2.3-70-g09d2