numerous fixes
This commit is contained in:
+1
-1
@@ -121,7 +121,7 @@
|
||||
<h3 class="dialog-title">Start exam</h3>
|
||||
<div class="dialog-text">
|
||||
Click to start exam.
|
||||
<p>You will have <input type='number' size=2 class='exam-time'></input> minutes.</p>
|
||||
<p>You will have <input type='number' size=2 class='exam-time2'></input> minutes.</p>
|
||||
</div>
|
||||
<div class="dialog-text">
|
||||
Check your below candidate number is correct.
|
||||
|
||||
+17
-3
@@ -2,19 +2,33 @@
|
||||
/**
|
||||
* Submits answers
|
||||
*/
|
||||
function submitAnswers() {
|
||||
export function submitAnswers(window, db) {
|
||||
console.log(
|
||||
getJsonAnswers().then((a) => {
|
||||
getJsonAnswers(window, db).then((a) => {
|
||||
postAnswers(a);
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a json representation of answers
|
||||
* @return {JSON} - answers
|
||||
*/
|
||||
export function getJsonAnswers(window, db) {
|
||||
const cid = window.cid;
|
||||
const eid = window.eid;
|
||||
return db.answers.where({ aid: aid, cid: cid, eid: eid }).toArray();
|
||||
// .then(function(ans) {
|
||||
// console.log(ans);
|
||||
// submitAnswers(ans);
|
||||
// });
|
||||
}
|
||||
|
||||
/**
|
||||
* Posts answers to url
|
||||
* @param {*} ans - json representation of answers
|
||||
*/
|
||||
function postAnswers(ans) {
|
||||
export function postAnswers(ans) {
|
||||
$("#progress").html(`Submitting answers...`);
|
||||
// ans = {"test" : 1}
|
||||
$.post(window.config.exam_submit_url, JSON.stringify(ans)).done(
|
||||
|
||||
+10
-17
@@ -1,7 +1,7 @@
|
||||
/* global Dexie, cornerstone, cornerstoneTools, cornerstoneBase64ImageLoader, cornerstoneWebImageLoader, cornerstoneWADOImageLoader */
|
||||
import * as helper from "./helpers.js";
|
||||
import * as viewer from "./viewer.js";
|
||||
import * as interact from "./viewer.js";
|
||||
import * as interact from "./interact.js";
|
||||
import * as config from "./config.js";
|
||||
// const { v4: uuidv4 } = require('uuid');
|
||||
|
||||
@@ -281,10 +281,16 @@ function setUpQuestions(load_previous) {
|
||||
}
|
||||
}
|
||||
|
||||
$(".exam-time")
|
||||
// We use a different dialog if we are in an exam
|
||||
let et = ".exam-time";
|
||||
if (window.exam_mode) {
|
||||
et = ".exam-time2";
|
||||
}
|
||||
|
||||
$(et)
|
||||
.val(window.exam_time / 60)
|
||||
.change(() => {
|
||||
window.exam_time = $(".exam-time").val() * 60;
|
||||
window.exam_time = $(et).val() * 60;
|
||||
});
|
||||
|
||||
if (window.exam_mode) {
|
||||
@@ -1061,7 +1067,7 @@ $("#btn-local-file-load").click(function (evt) {
|
||||
});
|
||||
|
||||
$("#submit-button").click(function (evt) {
|
||||
interact.submitAnswers();
|
||||
interact.submitAnswers(window, db);
|
||||
});
|
||||
|
||||
$("#review-button").click(function (evt) {
|
||||
@@ -1111,19 +1117,6 @@ $("#review-overlay-close").click(function (evt) {
|
||||
$("#review-overlay").hide();
|
||||
});
|
||||
|
||||
/**
|
||||
* Gets a json representation of answers
|
||||
* @return {JSON} - answers
|
||||
*/
|
||||
function getJsonAnswers() {
|
||||
const cid = window.cid;
|
||||
const eid = window.eid;
|
||||
return db.answers.where({ aid: aid, cid: cid, eid: eid }).toArray();
|
||||
// .then(function(ans) {
|
||||
// console.log(ans);
|
||||
// submitAnswers(ans);
|
||||
// });
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads a local question set (from a file)
|
||||
|
||||
Reference in New Issue
Block a user