diff options
author | Melody Horn <melody@boringcactus.com> | 2021-12-04 18:39:21 -0700 |
---|---|---|
committer | Melody Horn <melody@boringcactus.com> | 2021-12-04 18:39:21 -0700 |
commit | e0bf354bb6301761146d3025bdc6176c33877790 (patch) | |
tree | 4b677e0d73c7cf70fb9ba3855d24dd1f16c41a26 /src/lib.rs | |
parent | fa6a1adc2e174839e6230adb27db0ddbea62e6de (diff) | |
download | queue-go-brrr-e0bf354bb6301761146d3025bdc6176c33877790.tar.gz queue-go-brrr-e0bf354bb6301761146d3025bdc6176c33877790.zip |
disambiguate pending vs fucked ETA
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -13,6 +13,8 @@ use web_sys::*; mod history; mod ocr; +use history::{History, NoETA}; + // When the `wee_alloc` feature is enabled, use `wee_alloc` as the global // allocator. #[cfg(feature = "wee_alloc")] @@ -110,7 +112,7 @@ async fn do_boot() { let document = gloo::utils::document(); - let history = Rc::new(RefCell::new(history::History::default())); + let history = Rc::new(RefCell::new(History::default())); let (manual_update_tx, manual_update_rx) = mpsc::channel::<()>(5); @@ -252,7 +254,7 @@ async fn do_boot() { history.record(queue_size); let estimated_finish = history.completion_time(); let eta_text = match estimated_finish { - Some(finish) => { + Ok(finish) => { let empty_array = js_sys::Array::new(); let options = { let kv_pair = js_sys::Array::new(); @@ -271,7 +273,10 @@ async fn do_boot() { format.call1(&JsValue::UNDEFINED, &finish).unwrap(); locale_string.as_string().unwrap() } - None => format!("pending"), + Err(NoETA::Pending) => format!("pending"), + Err(NoETA::Fuck) => { + format!("fucked (try reloading i guess?)") + } }; let label = format!(" - ETA {}", eta_text); eta.set_inner_text(&label); |