Commit 1f16e090 authored by NARRA SURAJ's avatar NARRA SURAJ

disabled load test for attempted tests

parent ee12e8d0
......@@ -88,7 +88,7 @@ DATABASES = {
'USERNAME':'arfa_username',
'USER':'arfa_username',
'PASSWORD':'',
'HOST': '127.0.0.1',
'HOST': '10.42.0.172',
'PORT': '5430'
}
}
......
......@@ -13,7 +13,7 @@ Total Time :<b > {{total_time.hours}} {{total_time.minutes}} </b>
<p> Max Marks. <b>{{max_marks}}</b> </p>
<div id="Timer" style="border-style: solid; text-align: center;"></div>
</div>
<h2 align="center" style=" text-decoration: underline;"><b> {{testName.test_name}} </b> </h2>
<h2 align="center" style=" text-decoration: underline;"><b> {{testName.test_name}} </b> </h2>
</div>
<script>
function submitExam()
......
......@@ -17,16 +17,25 @@ My Tests
<ul class="list-group">
{% for t in activeTests %}
<div class="row" style="margin-bottom: 10px; margin-top: 5px">
<div style="float: left; margin-left: 20px">
<p><i>Test Id</i> <b> {{t.test_ID}}</b></p>
<p><i> Test Name</i> <b>{{t.test_name}}</b> </p>
</div>
</div>
<div style="float:right">
<form method="POST" action="loadStudentTest">
{% csrf_token %}
<input name="testID" value="{{t.test_ID}}" type="hidden">
<button type="submit" class="btn btn-login float-right" style="margin-top: 10px ;margin-right: 40px">Load Test</button>
{% if t.hasTaken is True %}
<button type="button" disabled class="btn btn-login float-right"
style="margin-top: 10px ;margin-right: 40px">Attempted</button>
{% else %}
<button type="submit" class="btn btn-login float-right"
style="margin-top: 10px ;margin-right: 40px">Load Test</button>
{% endif %}
</form>
</div>
</div>
{% endfor %}
</ul>
</div>
......@@ -50,12 +59,18 @@ My Tests
<form method="POST" action="loadStudentTest">
{% csrf_token %}
<input name="testID" value="{{t.test_ID}}" type="hidden">
<button type="submit" class="btn btn-login float-right" style="margin-top: 10px ;margin-right: 40px">Load Test</button>
<button type="submit" class="btn btn-login float-right"
style="margin-top: 10px ;margin-right: 40px">Load Test</button>
</form>
<form method="POST" action="viewTestPerformance">
{% csrf_token %}
{% if t.hasTaken is True %}
<input name="test_ID" value="{{t.test_ID}}" type="hidden">
<button type="submit" class="btn btn-login float-right" style="margin-top: 10px ;margin-right: 40px">View Results</button>
<button type="submit" class="btn btn-login float-right"
style="margin-top: 10px ;margin-right: 40px">View Results</button>
{% endif %}
</form>
</div>
</div>
......
......@@ -235,6 +235,7 @@ def studentTestHome(request):
return render(request,'ARFA_app/login.html')
if(request.session.get('role',None)!="student"):
return HttpResponse("Not a student")
username = request.session['username']
now = datetime.datetime.now()
print now
......@@ -242,12 +243,16 @@ def studentTestHome(request):
start_time__lte = now)
practiceTests = Test.objects.filter(start_time__lte = now - F('expected_time_for_completion'))
data = {}
data['username'] = request.session['username']
data['username'] = username
data['is_session'] = True
data['activeTests'] = []
#data['activeTests'] is a list of dicts. Each dict contains info about a test
for t in activeTests:
hasTaken = models.Takes.objects.filter(test_ID_id=t.test_ID, student_id=username).exists()
print "hastaken\n\n\n\n\n\n"
print hasTaken
data['activeTests'].append({'test_ID':t.test_ID, 'test_name':t.test_name,
'marks':t.max_marks, 'start_time':t.start_time})
'marks':t.max_marks, 'start_time':t.start_time, 'hasTaken':hasTaken})
data['practiceTests'] = []
for t in practiceTests:
......@@ -255,8 +260,10 @@ def studentTestHome(request):
# print t.test_ID
# print datetime.datetime.now() - t.start_time - t.expected_time_for_completion
# debug
hasTaken = models.Takes.objects.filter(test_ID_id=t.test_ID, student_id=username).exists()
data['practiceTests'].append({'test_ID':t.test_ID, 'test_name':t.test_name,
'marks':t.max_marks, 'start_time':t.start_time})
'marks':t.max_marks, 'start_time':t.start_time, 'hasTaken':hasTaken})
print data
return render(request, 'ARFA_app/studentTestHome.html', data)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment