This commit is contained in:
Ross
2021-12-12 12:13:19 +00:00
parent 8925268f98
commit 1bb04b9119
4 changed files with 20 additions and 6 deletions
@@ -12,6 +12,14 @@ Enter your CID and passcode in the below boxes.<br />
<script type="text/javascript">
$(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(() => {
let cid = $("#cid-box").val();
let passcode = $("#passcode-box").val();
+1 -1
View File
@@ -56,7 +56,7 @@ urlpatterns = [
path("accounts/", include("django.contrib.auth.urls")),
path("accounts/profile", views.profile, name="profile"),
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"),
# Global url that registers RTS compatible exams
path("exam/json/", views.active_exams, name="active_exams"),
+7 -3
View File
@@ -52,7 +52,7 @@ from rapids.views import RapidExamViews
from longs.views import LongExamViews
from generic.forms import QuestionNoteForm
from generic.models import QuestionNote
from generic.models import CidUser, QuestionNote
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)
# TODO:Need some kind of test for cid
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()
physics_answers = PhysicsCidUserAnswer.objects.filter(cid=cid)
anatomy_answers = AnatomyCidUserAnswer.objects.filter(cid=cid)
+4 -2
View File
@@ -3,8 +3,9 @@
{% block content %}
<div class="">
<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>Passcode: <input id="passcode-box" type="text" value="Passcode"></p>
<button id="cid-selector-go-button">Go...</button>
</div>
<script>
@@ -20,7 +21,8 @@
$("#cid-selector-go-button").click(() => {
cid = document.getElementById("cid-input").value;
window.location = window.location + cid;
passcode = document.getElementById("passcode-box").value;
window.location = window.location + cid + "/" + passcode;
})
})
</script>