From 1d6ffc0b718c460d5f9647c9263f047b5e0f470c Mon Sep 17 00:00:00 2001 From: Ross Date: Tue, 28 Apr 2020 19:08:28 +0100 Subject: [PATCH] Add marking / reviewing of longs --- css/main.css | 37 +++++++++++++++++++-- index.html | 2 +- js/main.js | 90 ++++++++++++++++++++++++++++++++++++++++++---------- 3 files changed, 109 insertions(+), 20 deletions(-) diff --git a/css/main.css b/css/main.css index 61175f2..ff88109 100644 --- a/css/main.css +++ b/css/main.css @@ -153,6 +153,7 @@ td { .question-list-panel * { -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); } .question-list-panel::after { @@ -277,6 +278,7 @@ td { .question * { -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); } .question::after { @@ -301,6 +303,7 @@ td { .answers * { -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); } .answer-panel { @@ -334,6 +337,7 @@ td { .exam-content-panel * { -webkit-transform: translate3d(0, 0, 0); + transform: translate3d(0, 0, 0); } .question { @@ -450,7 +454,6 @@ td { height: 8rem; min-height: 8rem; width: 100%; - vertical-align: top; border: 1px solid #4527A0; overflow: hidden; resize: none; @@ -464,7 +467,6 @@ td { .rapid-option-answer { width: 100%; display: block; - vertical-align: top; border: 1px solid #4527A0; margin: 0.8rem 1.6rem 1.6rem 1.6rem; overflow: hidden; @@ -829,4 +831,33 @@ select option:disabled { -webkit-transform: scale3D(0, 0, 1); transform: scale3D(0, 0, 1); } -} \ No newline at end of file +} + +.user-review-answer-list { +float: left; +width: 45%; +padding-left: 5%; +} +.model-review-answer-list { +float: right; +width: 45%; +padding-right: 5%; +} + +#review-answer-list li { +clear: both; +} + +.displayblock { +display: block +} + +.review-list-header { + font-weight: bold; + text-decoration: underline; +} + +.answer-sub { + opacity: 50%; + text-align: center; + } \ No newline at end of file diff --git a/index.html b/index.html index cef82d6..693deff 100644 --- a/index.html +++ b/index.html @@ -74,7 +74,7 @@
- +
diff --git a/js/main.js b/js/main.js index 65ef6df..ddaa4e2 100644 --- a/js/main.js +++ b/js/main.js @@ -589,9 +589,9 @@ function loadQuestion(n, section = 1, force_reload = false) { ap.append( '

' + display_n + - '.3Principle Diagnosis

' + '" data-qidn=3 style="margin-right:0">⚐

' ); ap.append( '

' + @@ -656,7 +656,10 @@ function loadQuestion(n, section = 1, force_reload = false) { .eq(parseInt(answer.qidn) - 1) .text(answer.ans); } - // markAnswer(qid, "anatomy"); + // We only want to mark once... + if (qidn_count == 5) { + markAnswer(qid, current_question); + } }) .catch(function (error) { console.log(error); @@ -773,7 +776,7 @@ function createQuestionListPanel() { * @param {number} qidn - question section number * @return {*} el - element that has been created */ - function appendReviewItem(n, qidn) { + function appendQuestionListItem(n, qidn) { const qn = n - 1; const el = $( '

    " + ); + + const model_answers = window.questions[qid].answers; + + const titles = [ + "Observations", + "Interpretation", + "Principal Diagnosis", + "Differential Diagnosis", + "Management", + ]; + + let user_li = $( + `#review-answer-${qid} span .user-review-answer-list` + ); + let model_li = $( + `#review-answer-${qid} span .model-review-answer-list` + ); + + user_li.append("
    Your answers
    "); + model_li.append("
    Model answers
    "); + + titles.forEach((title, n) => { + let user_answer = current_answers[`${qid},${n}`]; + if (user_answer == undefined) { + user_answer = "Not answered"; + } + user_li.append( + "

    " + title + "

    " + user_answer + ); + model_li.append( + `

    ` + + title + + "

    " + + model_answers[0][title.toLowerCase()] + ); + }); + + return; + } db.user_answers .get({ qid: qid }) .then(function (answers) { @@ -1385,8 +1435,6 @@ function reviewQuestions() { * @param {*} current_question - */ function markAnswer(qid, current_question) { - console.log("mark", qid); - const type = current_question.type; let option = null; @@ -1407,9 +1455,20 @@ function markAnswer(qid, current_question) { } // If answer is normal we have nothing else to add. addFeedback(current_question); + return; } } + if (type == "long") { + // For long cases we simple disable the texareas and append the + // model answers + const model_answers = current_question.answers[0]; + for (let key of Object.keys(model_answers)) { + $("textarea[name*='" + key + "' i]").after(model_answers[key]); + } + return; + } + $(".answer-panel").append( "
    Correct answer(s):
      " ); @@ -1554,7 +1613,6 @@ function addFlagEvents() { function loadFlagsFromDb(qid, n) { const cid = window.cid; const eid = window.eid; - console.log("loadFlagsFromDb", cid, eid, qid, n); db.flags .get({ cid: cid, eid: eid, qid: qid, qidn: n }) .then(function (answer) {