.
This commit is contained in:
@@ -326,6 +326,8 @@ class Rapid(models.Model):
|
|||||||
for a in self.abnormality.all():
|
for a in self.abnormality.all():
|
||||||
answers.append("{}{} {}".format(laterality, r.name, a.name))
|
answers.append("{}{} {}".format(laterality, r.name, a.name))
|
||||||
answers.append("{} {}{}".format(a.name, laterality, r.name))
|
answers.append("{} {}{}".format(a.name, laterality, r.name))
|
||||||
|
answers.append("{} {}".format(r.name, a.name))
|
||||||
|
answers.append("{} {}".format(a.name, r.name))
|
||||||
|
|
||||||
compare_answers = self.get_compare_answers()
|
compare_answers = self.get_compare_answers()
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,8 @@
|
|||||||
<p><b>Scrapped:</b> {{ question.scrapped }} <a href="{% url 'rapids:rapid_scrap' pk=question.pk %}">(toggle)</a>
|
<p><b>Scrapped:</b> {{ question.scrapped }} <a href="{% url 'rapids:rapid_scrap' pk=question.pk %}">(toggle)</a>
|
||||||
<p class="pre-whitespace">
|
<p class="pre-whitespace">
|
||||||
Answers (score): {% for answer in question.answers.all %}
|
Answers (score): {% for answer in question.answers.all %}
|
||||||
<span {% if answer.proposed %}class="proposed-answer" data-aid="{{answer.pk}}" data-question-type="rapid" {% endif %}>
|
<span {% if answer.proposed %}class="proposed-answer" data-aid="{{answer.pk}}" data-question-type="rapid" {%
|
||||||
|
endif %}>
|
||||||
{{ answer }} ({{answer.status}}),
|
{{ answer }} ({{answer.status}}),
|
||||||
</span>
|
</span>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
@@ -69,8 +70,8 @@
|
|||||||
<li data-string="{{ans}}">{{ans}}</li>
|
<li data-string="{{ans}}">{{ans}}</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
</details>
|
||||||
</div>
|
</div>
|
||||||
</details>
|
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
<summary>
|
<summary>
|
||||||
@@ -78,109 +79,109 @@
|
|||||||
</summary>
|
</summary>
|
||||||
<div id="single-dicom-viewer" class="dicom-viewer" data-images="{{ question.get_image_urls }}" data-annotations=''>
|
<div id="single-dicom-viewer" class="dicom-viewer" data-images="{{ question.get_image_urls }}" data-annotations=''>
|
||||||
</div>
|
</div>
|
||||||
</detail>
|
</details>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
|
||||||
$(".suggested_answers li").each((n, el) => {
|
$(".suggested_answers li").each((n, el) => {
|
||||||
$(el).append($("<span class='correct'>[Add Correct]</span>").on("click", function () {
|
$(el).append($("<span class='correct'>[Add Correct]</span>").on("click", function () {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "{% url 'answer_submit' %}",
|
url: "{% url 'answer_submit' %}",
|
||||||
data: {
|
data: {
|
||||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||||
//active: this.checked // true if checked else false
|
//active: this.checked // true if checked else false
|
||||||
question_type: "rapid",
|
question_type: "rapid",
|
||||||
qid: "{{question.pk}}",
|
qid: "{{question.pk}}",
|
||||||
status: 2,
|
status: 2,
|
||||||
answer: el.dataset.string,
|
answer: el.dataset.string,
|
||||||
},
|
},
|
||||||
type: "POST",
|
type: "POST",
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
|
})
|
||||||
|
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
||||||
|
.done(function (data) {
|
||||||
|
console.log(data);
|
||||||
|
|
||||||
|
if (data.success) {
|
||||||
|
toastr.info('Answer saved')
|
||||||
|
$(el).find(".correct").remove()
|
||||||
|
}
|
||||||
|
// show some message according to the response.
|
||||||
|
// For eg. A message box showing that the status has been changed
|
||||||
})
|
})
|
||||||
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
.always(function () {
|
||||||
.done(function (data) {
|
console.log('[Done]');
|
||||||
console.log(data);
|
|
||||||
|
|
||||||
if (data.success) {
|
|
||||||
toastr.info('Answer saved')
|
|
||||||
$(el).find(".correct").remove()
|
|
||||||
}
|
|
||||||
// show some message according to the response.
|
|
||||||
// For eg. A message box showing that the status has been changed
|
|
||||||
})
|
|
||||||
.always(function () {
|
|
||||||
console.log('[Done]');
|
|
||||||
})
|
|
||||||
}))
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
// send request to change the is_private state on customSwitches toggle
|
|
||||||
$(".proposed-answer").each((n, el) => {
|
|
||||||
|
|
||||||
// Add button to confirm answer is correct
|
|
||||||
$(el).append($("<span class='confirm'>[Add Correct]</span>").on("click", function () {
|
|
||||||
$.ajax({
|
|
||||||
url: "{% url 'answer_suggestion_confirm' %}",
|
|
||||||
data: {
|
|
||||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
|
||||||
//active: this.checked // true if checked else false
|
|
||||||
question_type: "rapid",
|
|
||||||
aid: el.dataset.aid,
|
|
||||||
status: 2,
|
|
||||||
},
|
|
||||||
type: "POST",
|
|
||||||
dataType: "json",
|
|
||||||
})
|
})
|
||||||
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
}))
|
||||||
.done(function (data) {
|
|
||||||
console.log(data);
|
|
||||||
|
|
||||||
if (data.success) {
|
|
||||||
toastr.info('Answer saved')
|
|
||||||
$(el).find(".confirm").remove()
|
|
||||||
$(el).removeClass("proposed-answer")
|
|
||||||
}
|
|
||||||
// show some message according to the response.
|
|
||||||
// For eg. A message box showing that the status has been changed
|
|
||||||
})
|
|
||||||
.always(function () {
|
|
||||||
console.log('[Done]');
|
|
||||||
})
|
|
||||||
}))
|
|
||||||
|
|
||||||
// Add button to confirm answer is incorrect
|
|
||||||
$(el).append($("<span class='confirm'>[Incorrect]</span>").on("click", function () {
|
|
||||||
$.ajax({
|
|
||||||
url: "{% url 'answer_suggestion_confirm' %}",
|
|
||||||
data: {
|
|
||||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
|
||||||
//active: this.checked // true if checked else false
|
|
||||||
question_type: "rapid",
|
|
||||||
aid: el.dataset.aid,
|
|
||||||
status: 0,
|
|
||||||
},
|
|
||||||
type: "POST",
|
|
||||||
dataType: "json",
|
|
||||||
})
|
|
||||||
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
|
||||||
.done(function (data) {
|
|
||||||
console.log(data);
|
|
||||||
|
|
||||||
if (data.success) {
|
|
||||||
toastr.info('Answer saved')
|
|
||||||
$(el).find(".confirm").remove()
|
|
||||||
$(el).removeClass("proposed-answer")
|
|
||||||
}
|
|
||||||
// show some message according to the response.
|
|
||||||
// For eg. A message box showing that the status has been changed
|
|
||||||
})
|
|
||||||
.always(function () {
|
|
||||||
console.log('[Done]');
|
|
||||||
})
|
|
||||||
}))
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
// send request to change the is_private state on customSwitches toggle
|
||||||
|
$(".proposed-answer").each((n, el) => {
|
||||||
|
|
||||||
|
// Add button to confirm answer is correct
|
||||||
|
$(el).append($("<span class='confirm'>[Add Correct]</span>").on("click", function () {
|
||||||
|
$.ajax({
|
||||||
|
url: "{% url 'answer_suggestion_confirm' %}",
|
||||||
|
data: {
|
||||||
|
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||||
|
//active: this.checked // true if checked else false
|
||||||
|
question_type: "rapid",
|
||||||
|
aid: el.dataset.aid,
|
||||||
|
status: 2,
|
||||||
|
},
|
||||||
|
type: "POST",
|
||||||
|
dataType: "json",
|
||||||
|
})
|
||||||
|
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
||||||
|
.done(function (data) {
|
||||||
|
console.log(data);
|
||||||
|
|
||||||
|
if (data.success) {
|
||||||
|
toastr.info('Answer saved')
|
||||||
|
$(el).find(".confirm").remove()
|
||||||
|
$(el).removeClass("proposed-answer")
|
||||||
|
}
|
||||||
|
// show some message according to the response.
|
||||||
|
// For eg. A message box showing that the status has been changed
|
||||||
|
})
|
||||||
|
.always(function () {
|
||||||
|
console.log('[Done]');
|
||||||
|
})
|
||||||
|
}))
|
||||||
|
|
||||||
|
// Add button to confirm answer is incorrect
|
||||||
|
$(el).append($("<span class='confirm'>[Incorrect]</span>").on("click", function () {
|
||||||
|
$.ajax({
|
||||||
|
url: "{% url 'answer_suggestion_confirm' %}",
|
||||||
|
data: {
|
||||||
|
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||||
|
//active: this.checked // true if checked else false
|
||||||
|
question_type: "rapid",
|
||||||
|
aid: el.dataset.aid,
|
||||||
|
status: 0,
|
||||||
|
},
|
||||||
|
type: "POST",
|
||||||
|
dataType: "json",
|
||||||
|
})
|
||||||
|
// $.ajax().done(), $.ajax().fail(), $ajax().always() are upto you. Add/change accordingly
|
||||||
|
.done(function (data) {
|
||||||
|
console.log(data);
|
||||||
|
|
||||||
|
if (data.success) {
|
||||||
|
toastr.info('Answer saved')
|
||||||
|
$(el).find(".confirm").remove()
|
||||||
|
$(el).removeClass("proposed-answer")
|
||||||
|
}
|
||||||
|
// show some message according to the response.
|
||||||
|
// For eg. A message box showing that the status has been changed
|
||||||
|
})
|
||||||
|
.always(function () {
|
||||||
|
console.log('[Done]');
|
||||||
|
})
|
||||||
|
}))
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
</script>
|
||||||
Reference in New Issue
Block a user