Commit 5ca0fc72 authored by SANCHIT JAIN's avatar SANCHIT JAIN

remove prints

parent 82070acd
......@@ -88,7 +88,7 @@ DATABASES = {
'USERNAME':'arfa_username',
'USER':'arfa_username',
'PASSWORD':'',
'HOST': '127.0.0.1',
'HOST': '10.42.0.43',
'PORT': '5430'
}
}
......
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-11-27 03:40
# Generated by Django 1.11.15 on 2018-11-27 04:14
from __future__ import unicode_literals
import django.core.validators
......
......@@ -29,7 +29,7 @@ chart.draw(data, {width: 500, height: 300, title: "Scores Distribution"});
{%block body%}
<h1 style="text-align:center"> Test Performance</h1>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css">
<!-- <link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css"> -->
<div class="container">
<div class="panel-default">
<div class="panel-heading">
......@@ -97,15 +97,24 @@ chart.draw(data, {width: 500, height: 300, title: "Scores Distribution"});
<h3 class="panel-title"> Per Question stats </h3>
</div>
<ul class="list-group">
{%for q in question_stats%}
{%for question in question_stats%}
<li class="list-group-item">
<!-- <li> -->
<div class="row toggle">
<div class="col-xs-10">
<p> Difficulty set: {{q.difficulty_set}}</p>
<p> Difficulty observed: {{q.difficulty_observed}}</p>
<p> Question: {{q.question_text}} </p>
{{question.question_text}} </br>
<p style="float:right;"><b>Difficulty: </b> {{question.difficulty_set}}</p>
{%if question.ip%}
{%load static%}
<div align="center">
<img src = "{% static "" %}{{question.ip|slice:"16:" }}" width="35%" height="35%">
<p style="margin-top:5px">
{{question.imdesc}}
</p>
</div>
{%endif%}
</div>
</div>
<div>
......@@ -114,7 +123,7 @@ chart.draw(data, {width: 500, height: 300, title: "Scores Distribution"});
<!-- <div class="container"> -->
<!-- <div class="fluid-row"> -->
<ul>
{%for option in q.option_details%}
{%for option in question.option_details%}
{%if option.is_answer %}
<li>
<p style="color: green"> {{option.option_text}} </p>
......
......@@ -120,15 +120,23 @@ chart.draw(data, {width: 500, height: 300, title: "Scores Distribution"});
<h3 class="panel-title"> Per Question stats </h3>
</div>
<ul class="list-group">
{%for q in question_stats%}
{%for question in question_stats%}
<li class="list-group-item">
<!-- <li> -->
<div class="row toggle">
<div class="col-xs-10">
<p> Difficulty set: {{q.difficulty_set}}</p>
<p> Difficulty observed: {{q.difficulty_observed}}</p>
<p> Question: {{q.question_text}} </p>
{{question.question_text}} </br>
<p style="float:right;"><b>Difficulty: </b> {{question.difficulty_set}}</p>
{%if question.ip%}
{%load static%}
<div align="center">
<img src = "{% static "" %}{{question.ip|slice:"16:" }}" width="35%" height="35%">
<p style="margin-top:5px">
{{question.imdesc}}
</p>
</div>
{%endif%}
</div>
</div>
<div>
......@@ -137,7 +145,7 @@ chart.draw(data, {width: 500, height: 300, title: "Scores Distribution"});
<!-- <div class="container"> -->
<!-- <div class="fluid-row"> -->
<ul>
{%for option in q.option_details%}
{%for option in question.option_details%}
{%if option.is_answer %}
<li>
<p style="color: green"> {{option.option_text}} </p>
......
......@@ -31,16 +31,11 @@ def evaluate(responses, otherData):
if len(responses) == 0:
return
#debugging:
print "responses:"
print responses
#marks for each question:
#list of question ids
print "QList"
QList = [int(question) for [(question, _)] in [response.items() for response in responses]]
print QList
#select contains objects for which test_ID=tetsID, q_ID belongs to list QList
contains = models.Contains.objects.filter(test_ID=otherData['testID'], q_ID__in=QList)
......@@ -71,7 +66,6 @@ def evaluate(responses, otherData):
# evalObj.marks = 1
responseList = options
print correctAnswer
if len(responseList) == len(correctAnswer) and sorted(responseList) == sorted(correctAnswer):
evalObj.marks = marksDict[question][0] #0 - first in the list, marks_pos
......@@ -208,7 +202,6 @@ def result_analysis(request,test_ID):
def get_questions_dict(cursor):
rows = cursor.fetchall()
print rows
columns = [col[0] for col in cursor.description]
res=[]
options_so_far = []
......@@ -237,9 +230,10 @@ def get_questions_dict(cursor):
def get_responses_side_by_side(test,student):
cursor = connection.cursor()
cursor.execute(''' SELECT q."q_ID" as q_ID,q.question_text,
cursor.execute(''' SELECT q."q_ID" as q_ID,q.question_text, q.image as ip , q."imageDesc" as imdesc,
o."option_Value" as option_details,o."is_Answer"
FROM "ARFA_app_contains" as c,"ARFA_app_question" as q,
FROM "ARFA_app_contains" as c, ("ARFA_app_question" as u LEFT OUTER JOIN "ARFA_app_questionimage" as v ON
u."q_ID" = v."q_ID_id") as q,
"ARFA_app_options" as o, "ARFA_app_subject" as s
WHERE o."q_ID_id" = q."q_ID" and c."q_ID_id" = q."q_ID" and q."subject_ID_id" = s."subject_ID"
and c."test_ID_id" = %s
......
......@@ -242,7 +242,6 @@ def studentTestHome(request):
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()
data['activeTests'].append({'test_ID':t.test_ID, 'test_name':t.test_name,
......@@ -441,34 +440,7 @@ def create_Test(request):
data.pop('csrfmiddlewaretoken')
if not data: #only csrf token was sent, display create test page
return render(request,'ARFA_app/create_Test.html',args)
print data
form = forms.TestForm(request.POST)
#A failed attempt to make html datetimeinput work.
#refer to this when you want to try again.
# """dirty workaround"""
# #the data in request.POST must be modified to be valid in the form
# data['start_time'] = data['start_time'][0].replace('T', ' ') #remove the 'T' in HTML returned string
# data['expected_time_for_completion'] = data['expected_time_for_completion'][0]+":00"
# #add seconds to duration string
# data['max_marks'] = int(data['max_marks'][0]) #convert max_marks from string to int
# #if these are not in these exact formats everything may break.
# #see form cleanup for a potentially better solution
# qdict = QueryDict("", mutable=True)
# qdict.update(data)
# form2 = forms.TestForm(request.POST)
# print "form2:"
# print vars(form2)
# print "\n\n\n"
# #debug
# print "start time"
# print form
# print vars(form)
# #debug
max_marks = 0
test = None
......@@ -519,18 +491,13 @@ def create_Test(request):
containsObj.pk = None
containsObj.save()
print "success"
print containsObj
except ValueError as e:
data.pop(q)
print e
continue
#schedule ranking function when test is finished
print type(test.start_time)
print type(test.expected_time_for_completion)
tasks.testRanks(test.test_ID, schedule=(test.start_time+test.expected_time_for_completion))
print test.start_time+test.expected_time_for_completion
print "testRanks being called\n\n\n\n"
return view_personal_Test(request)
......@@ -566,7 +533,6 @@ def add_question(request):
try:
question_data = dict(json.loads(request.POST['client_response']))
args = question_data['question_data']
print args['question_text']
if args['question_text']=='':
print 'failed'
return HttpResponse(json.dumps({'status':'Failed','reason':'No question provided'}))
......@@ -608,7 +574,6 @@ def view_personal_Test(request):
WHERE c."test_ID_id" = t."test_ID" and c.faculty_id = %s
order by t.start_time desc ''',[request.session['username']])
rows = cursor.fetchall()
print rows
columns = [col[0] for col in cursor.description]
res = []
for val in rows:
......@@ -630,7 +595,6 @@ def view_all_Test(request):
WHERE t.start_time < current_timestamp
order by t.start_time desc ''')
rows = cursor.fetchall()
print rows
columns = [col[0] for col in cursor.description]
res = []
for val in rows:
......@@ -645,23 +609,17 @@ def analyse_test(request):
return render(request,'ARFA_app/login.html')
test_ID = 0
print request.POST
if request.method == "GET":
test_ID = request.GET["test_ID"]
if request.method == "POST":
test_ID = request.POST["test_ID"]
print "test_ID"
print test_ID
test = models.Test.objects.filter(test_ID=test_ID ,
start_time__lte = datetime.timedelta(minutes=5) + datetime.datetime.now() - F('expected_time_for_completion')).all()
# n = models.Created_BY().objects.filter(test_ID=test).all()
# print datetime.timedelta(minutes=5) + datetime.datetime.now() - F('expected_time_for_completion')
if len(test)==0:
return HttpResponse("test does not exist/not completed")
# if test[0].start_time < datetime.datetime.now():
args = result_analysis(request,test_ID)
args.update(request.session.get('args',None))
return render(request,'ARFA_app/performance.html',args)
......@@ -681,7 +639,7 @@ def student_results(request):
test_ID = request.POST["test_ID"]
test = models.Test.objects.filter(test_ID=test_ID ,
start_time__lte = datetime.timedelta(minutes=5) + datetime.datetime.now() - F('expected_time_for_completion')).all()
start_time__lte = -datetime.timedelta(minutes=5) + datetime.datetime.now() - F('expected_time_for_completion')).all()
if len(test)==0:
......@@ -727,7 +685,7 @@ def student_responses(request):
test = models.Test.objects.filter(test_ID=test_ID ,
start_time__lte = datetime.timedelta(minutes=5) + datetime.datetime.now() - F('expected_time_for_completion')).all()
start_time__lte = -datetime.timedelta(minutes=5) + datetime.datetime.now() - F('expected_time_for_completion')).all()
if len(test)==0:
......
This diff is collapsed.
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