Skip to content

Commit

Permalink
Merge pull request #189 from AppraiseDev/vilemz/permissible-esa-uploa…
Browse files Browse the repository at this point in the history
…ding

Catch ESA submission errors
  • Loading branch information
snukky authored Aug 19, 2024
2 parents 2faaf79 + 659931f commit f7f360c
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions EvalView/static/EvalView/js/direct-assessment-document-mqm-esa.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,22 +243,25 @@ async function submit_finish_document(override_tutorial_check=false) {
}
}
}

// prevent multiclicks
$("#button-next-doc").prop('disabled', true);

$("#form-next-doc > input[name='end_timestamp']").val(Date.now() / 1000)

// wait for individual items to be submitted
for (const el of $(".item-box")) {
await submit_form_ajax($(el))
}
try {
for (const el of $(".item-box")) {
await submit_form_ajax($(el))
}

// trigger hidden form
$("#form-next-doc").trigger("submit")
// trigger hidden form if all is good
$("#form-next-doc").trigger("submit")
} catch {
// re-enable next doc button in a few seconds if not
await new Promise(resolve => setTimeout(resolve, 5_000))
$("#button-next-doc").prop('disabled', false);
}

await new Promise(resolve => setTimeout(resolve, 5_000))
$("#button-next-doc").prop('disabled', false);
}

function _show_error_box(text, timeout = 2000) {
Expand Down

0 comments on commit f7f360c

Please sign in to comment.