/* OpenTally: Open-source election vote counting
* Copyright © 2021 Lee Yingtong Li (RunasSudo)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see
Stage comments:
'; olStageComments = document.createElement('ol'); divLogs2.append(olStageComments); // Init STV options let opts = wasm.STVOptions.new( document.getElementById('chkRoundTVs').checked ? parseInt(document.getElementById('txtRoundTVs').value) : null, document.getElementById('chkRoundWeights').checked ? parseInt(document.getElementById('txtRoundWeights').value) : null, document.getElementById('chkRoundVotes').checked ? parseInt(document.getElementById('txtRoundVotes').value) : null, document.getElementById('chkRoundQuota').checked ? parseInt(document.getElementById('txtRoundQuota').value) : null, document.getElementById('selQuota').value, document.getElementById('selQuotaCriterion').value, document.getElementById('selTransfers').value, document.getElementById('selSurplus').value, document.getElementById('selPapers').value == 'transferable', document.getElementById('selExclusion').value, parseInt(document.getElementById('txtPPDP').value), ); // Describe count let filePath = document.getElementById('bltFile').value; filePath = filePath.substring(Math.max(filePath.lastIndexOf('\\'), filePath.lastIndexOf('/')) + 1); document.getElementById('resultLogs1').innerHTML = wasm.describe_count_Rational(filePath, election, opts); // Step election let state = wasm.CountStateRational.new(election); wasm.count_init_Rational(state, opts); updateResultTable(wasm.update_results_table_Rational(1, state, opts)); updateStageComments(wasm.update_stage_comments_Rational(state)); for (let stageNum = 2;; stageNum++) { let isDone = wasm.count_one_stage_Rational(state, opts); if (isDone) { break; } updateResultTable(wasm.update_results_table_Rational(stageNum, state, opts)); updateStageComments(wasm.update_stage_comments_Rational(state)); } updateResultTable(wasm.finalise_results_table_Rational(state)); divLogs2.insertAdjacentHTML('beforeend', wasm.final_result_summary_Rational(state)); }