.
This commit is contained in:
@@ -326,6 +326,8 @@ class Rapid(models.Model):
|
||||
for a in self.abnormality.all():
|
||||
answers.append("{}{} {}".format(laterality, r.name, a.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()
|
||||
|
||||
|
||||
@@ -31,7 +31,8 @@
|
||||
<p><b>Scrapped:</b> {{ question.scrapped }} <a href="{% url 'rapids:rapid_scrap' pk=question.pk %}">(toggle)</a>
|
||||
<p class="pre-whitespace">
|
||||
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}}),
|
||||
</span>
|
||||
{% endfor %}
|
||||
@@ -69,8 +70,8 @@
|
||||
<li data-string="{{ans}}">{{ans}}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</details>
|
||||
</div>
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary>
|
||||
@@ -78,109 +79,109 @@
|
||||
</summary>
|
||||
<div id="single-dicom-viewer" class="dicom-viewer" data-images="{{ question.get_image_urls }}" data-annotations=''>
|
||||
</div>
|
||||
</detail>
|
||||
</details>
|
||||
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
<script>
|
||||
$(document).ready(function () {
|
||||
|
||||
$(".suggested_answers li").each((n, el) => {
|
||||
$(el).append($("<span class='correct'>[Add Correct]</span>").on("click", function () {
|
||||
$.ajax({
|
||||
url: "{% url 'answer_submit' %}",
|
||||
data: {
|
||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||
//active: this.checked // true if checked else false
|
||||
question_type: "rapid",
|
||||
qid: "{{question.pk}}",
|
||||
status: 2,
|
||||
answer: el.dataset.string,
|
||||
},
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
$(".suggested_answers li").each((n, el) => {
|
||||
$(el).append($("<span class='correct'>[Add Correct]</span>").on("click", function () {
|
||||
$.ajax({
|
||||
url: "{% url 'answer_submit' %}",
|
||||
data: {
|
||||
csrfmiddlewaretoken: "{{ csrf_token }}",
|
||||
//active: this.checked // true if checked else false
|
||||
question_type: "rapid",
|
||||
qid: "{{question.pk}}",
|
||||
status: 2,
|
||||
answer: el.dataset.string,
|
||||
},
|
||||
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(".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
|
||||
.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
|
||||
})
|
||||
.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",
|
||||
.always(function () {
|
||||
console.log('[Done]');
|
||||
})
|
||||
// $.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