.
This commit is contained in:
@@ -12,6 +12,14 @@ Enter your CID and passcode in the below boxes.<br />
|
|||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
$("#cid-box, #passcode-box").keypress(function(e) {
|
||||||
|
// Enter pressed?
|
||||||
|
console.log(e)
|
||||||
|
if(e.which == 10 || e.which == 13) {
|
||||||
|
$("button").click();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$("button").click(() => {
|
$("button").click(() => {
|
||||||
let cid = $("#cid-box").val();
|
let cid = $("#cid-box").val();
|
||||||
let passcode = $("#passcode-box").val();
|
let passcode = $("#passcode-box").val();
|
||||||
|
|||||||
+1
-1
@@ -56,7 +56,7 @@ urlpatterns = [
|
|||||||
path("accounts/", include("django.contrib.auth.urls")),
|
path("accounts/", include("django.contrib.auth.urls")),
|
||||||
path("accounts/profile", views.profile, name="profile"),
|
path("accounts/profile", views.profile, name="profile"),
|
||||||
path("", TemplateView.as_view(template_name="index.html"), name="home"),
|
path("", TemplateView.as_view(template_name="index.html"), name="home"),
|
||||||
path("cid/<int:pk>", views.cid_scores, name="cid_scores"),
|
path("cid/<int:pk>/<str:passcode>/?", views.cid_scores, name="cid_scores"),
|
||||||
path("cid/", views.cid_selector, name="cid_selector"),
|
path("cid/", views.cid_selector, name="cid_selector"),
|
||||||
# Global url that registers RTS compatible exams
|
# Global url that registers RTS compatible exams
|
||||||
path("exam/json/", views.active_exams, name="active_exams"),
|
path("exam/json/", views.active_exams, name="active_exams"),
|
||||||
|
|||||||
+7
-3
@@ -52,7 +52,7 @@ from rapids.views import RapidExamViews
|
|||||||
from longs.views import LongExamViews
|
from longs.views import LongExamViews
|
||||||
|
|
||||||
from generic.forms import QuestionNoteForm
|
from generic.forms import QuestionNoteForm
|
||||||
from generic.models import QuestionNote
|
from generic.models import CidUser, QuestionNote
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
@@ -76,12 +76,16 @@ def cid_selector(request):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def cid_scores(request, pk):
|
def cid_scores(request, pk, passcode):
|
||||||
# exam = get_object_or_404(Exam, pk=pk)
|
# exam = get_object_or_404(Exam, pk=pk)
|
||||||
|
|
||||||
# TODO:Need some kind of test for cid
|
|
||||||
cid = pk
|
cid = pk
|
||||||
|
|
||||||
|
cid_user = get_object_or_404(CidUser, pk=cid)
|
||||||
|
if cid_user.passcode != passcode:
|
||||||
|
Http404("CID / Passcode combination not found")
|
||||||
|
|
||||||
|
|
||||||
# questions = exam.exam_questions.all()
|
# questions = exam.exam_questions.all()
|
||||||
physics_answers = PhysicsCidUserAnswer.objects.filter(cid=cid)
|
physics_answers = PhysicsCidUserAnswer.objects.filter(cid=cid)
|
||||||
anatomy_answers = AnatomyCidUserAnswer.objects.filter(cid=cid)
|
anatomy_answers = AnatomyCidUserAnswer.objects.filter(cid=cid)
|
||||||
|
|||||||
@@ -3,8 +3,9 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="">
|
<div class="">
|
||||||
<h2>Score / Results checker</h2>
|
<h2>Score / Results checker</h2>
|
||||||
<p>Please enter your CID</p>
|
<p>Please enter your CID and passcode</p>
|
||||||
<p>CID: <input type="text" name="cid" id="cid-input"></p>
|
<p>CID: <input type="text" name="cid" id="cid-input"></p>
|
||||||
|
<p>Passcode: <input id="passcode-box" type="text" value="Passcode"></p>
|
||||||
<button id="cid-selector-go-button">Go...</button>
|
<button id="cid-selector-go-button">Go...</button>
|
||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
@@ -20,7 +21,8 @@
|
|||||||
|
|
||||||
$("#cid-selector-go-button").click(() => {
|
$("#cid-selector-go-button").click(() => {
|
||||||
cid = document.getElementById("cid-input").value;
|
cid = document.getElementById("cid-input").value;
|
||||||
window.location = window.location + cid;
|
passcode = document.getElementById("passcode-box").value;
|
||||||
|
window.location = window.location + cid + "/" + passcode;
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user