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

disabled load test for attempted tests

parent ee12e8d0
...@@ -88,7 +88,7 @@ DATABASES = { ...@@ -88,7 +88,7 @@ DATABASES = {
'USERNAME':'arfa_username', 'USERNAME':'arfa_username',
'USER':'arfa_username', 'USER':'arfa_username',
'PASSWORD':'', 'PASSWORD':'',
'HOST': '127.0.0.1', 'HOST': '10.42.0.172',
'PORT': '5430' 'PORT': '5430'
} }
} }
......
...@@ -13,7 +13,7 @@ Total Time :<b > {{total_time.hours}} {{total_time.minutes}} </b> ...@@ -13,7 +13,7 @@ Total Time :<b > {{total_time.hours}} {{total_time.minutes}} </b>
<p> Max Marks. <b>{{max_marks}}</b> </p> <p> Max Marks. <b>{{max_marks}}</b> </p>
<div id="Timer" style="border-style: solid; text-align: center;"></div> <div id="Timer" style="border-style: solid; text-align: center;"></div>
</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> </div>
<script> <script>
function submitExam() function submitExam()
......
...@@ -17,16 +17,25 @@ My Tests ...@@ -17,16 +17,25 @@ My Tests
<ul class="list-group"> <ul class="list-group">
{% for t in activeTests %} {% for t in activeTests %}
<div class="row" style="margin-bottom: 10px; margin-top: 5px"> <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 Id</i> <b> {{t.test_ID}}</b></p>
<p><i> Test Name</i> <b>{{t.test_name}}</b> </p> <p><i> Test Name</i> <b>{{t.test_name}}</b> </p>
</div> </div>
<div style="float:right"> <div style="float:right">
<form method="POST" action="loadStudentTest"> <form method="POST" action="loadStudentTest">
{% csrf_token %} {% csrf_token %}
<input name="testID" value="{{t.test_ID}}" type="hidden"> <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> </form>
</div> </div>
</div>
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>
...@@ -50,12 +59,18 @@ My Tests ...@@ -50,12 +59,18 @@ My Tests
<form method="POST" action="loadStudentTest"> <form method="POST" action="loadStudentTest">
{% csrf_token %} {% csrf_token %}
<input name="testID" value="{{t.test_ID}}" type="hidden"> <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>
<form method="POST" action="viewTestPerformance"> <form method="POST" action="viewTestPerformance">
{% csrf_token %} {% csrf_token %}
{% if t.hasTaken is True %}
<input name="test_ID" value="{{t.test_ID}}" type="hidden"> <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> </form>
</div> </div>
</div> </div>
......
...@@ -235,6 +235,7 @@ def studentTestHome(request): ...@@ -235,6 +235,7 @@ def studentTestHome(request):
return render(request,'ARFA_app/login.html') return render(request,'ARFA_app/login.html')
if(request.session.get('role',None)!="student"): if(request.session.get('role',None)!="student"):
return HttpResponse("Not a student") return HttpResponse("Not a student")
username = request.session['username']
now = datetime.datetime.now() now = datetime.datetime.now()
print now print now
...@@ -242,12 +243,16 @@ def studentTestHome(request): ...@@ -242,12 +243,16 @@ def studentTestHome(request):
start_time__lte = now) start_time__lte = now)
practiceTests = Test.objects.filter(start_time__lte = now - F('expected_time_for_completion')) practiceTests = Test.objects.filter(start_time__lte = now - F('expected_time_for_completion'))
data = {} data = {}
data['username'] = request.session['username'] data['username'] = username
data['is_session'] = True data['is_session'] = True
data['activeTests'] = [] data['activeTests'] = []
#data['activeTests'] is a list of dicts. Each dict contains info about a test
for t in activeTests: 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, 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'] = [] data['practiceTests'] = []
for t in practiceTests: for t in practiceTests:
...@@ -255,8 +260,10 @@ def studentTestHome(request): ...@@ -255,8 +260,10 @@ def studentTestHome(request):
# print t.test_ID # print t.test_ID
# print datetime.datetime.now() - t.start_time - t.expected_time_for_completion # print datetime.datetime.now() - t.start_time - t.expected_time_for_completion
# debug # 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, 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 print data
return render(request, 'ARFA_app/studentTestHome.html', 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