diff --git a/html/index.js b/html/index.js
index ddb02f4..08e0183 100644
--- a/html/index.js
+++ b/html/index.js
@@ -48,7 +48,18 @@ worker.onmessage = function(evt) {
} else if (evt.data.type === 'updateResultsTable') {
for (let i = 0; i < evt.data.result.length; i++) {
- tblResult.rows[i].insertAdjacentHTML('beforeend', evt.data.result[i]);
+ if (evt.data.result[i]) {
+ tblResult.rows[i].insertAdjacentHTML('beforeend', evt.data.result[i]);
+
+ // Update candidate status
+ if (i >= 3 && i % 2 == 1) {
+ if (tblResult.rows[i].lastElementChild.classList.contains('elected')) {
+ tblResult.rows[i].cells[0].classList.add('elected');
+ } else {
+ tblResult.rows[i].cells[0].classList.remove('elected');
+ }
+ }
+ }
}
} else if (evt.data.type === 'updateStageComments') {