Fix web UI crash when tie requires manual intervention in first stage
This commit is contained in:
parent
5a652cb466
commit
ba82828046
@ -64,13 +64,7 @@ onmessage = function(evt) {
|
|||||||
|
|
||||||
// Step election
|
// Step election
|
||||||
state = wasm['CountState' + numbers].new(election);
|
state = wasm['CountState' + numbers].new(election);
|
||||||
wasm['count_init_' + numbers](state, opts);
|
stageNum = 1;
|
||||||
|
|
||||||
postMessage({'type': 'updateResultsTable', 'result': wasm['update_results_table_' + numbers](1, state, opts, reportStyle)});
|
|
||||||
postMessage({'type': 'updateStageComments', 'comment': wasm['update_stage_comments_' + numbers](state)});
|
|
||||||
|
|
||||||
stageNum = 2;
|
|
||||||
|
|
||||||
resumeCount();
|
resumeCount();
|
||||||
|
|
||||||
} else if (evt.data.type == 'userInput') {
|
} else if (evt.data.type == 'userInput') {
|
||||||
@ -92,7 +86,12 @@ onmessage = function(evt) {
|
|||||||
|
|
||||||
function resumeCount() {
|
function resumeCount() {
|
||||||
for (;; stageNum++) {
|
for (;; stageNum++) {
|
||||||
let isDone = wasm['count_one_stage_' + numbers](state, opts);
|
let isDone;
|
||||||
|
if (stageNum <= 1) {
|
||||||
|
isDone = wasm['count_init_' + numbers](state, opts);
|
||||||
|
} else {
|
||||||
|
isDone = wasm['count_one_stage_' + numbers](state, opts);
|
||||||
|
}
|
||||||
|
|
||||||
if (wasmRaw.asyncify_get_state() !== 0) {
|
if (wasmRaw.asyncify_get_state() !== 0) {
|
||||||
// This stage caused a stack unwind in get_user_input so ignore the result
|
// This stage caused a stack unwind in get_user_input so ignore the result
|
||||||
|
@ -455,7 +455,13 @@ impl<'e, N: Number> TransferTable<'e, N> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Render table as plain text
|
/// Render table as plain text
|
||||||
//#[cfg(not(target_arch = "wasm32"))]
|
#[cfg(not(target_arch = "wasm32"))]
|
||||||
|
pub fn render_text(&self, opts: &STVOptions) -> String {
|
||||||
|
return self.render(opts).to_string();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Render table as HTML
|
||||||
|
#[cfg(target_arch = "wasm32")]
|
||||||
pub fn render_text(&self, opts: &STVOptions) -> String {
|
pub fn render_text(&self, opts: &STVOptions) -> String {
|
||||||
return self.render(opts).to_html();
|
return self.render(opts).to_html();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user