Commit 9eb52c1a authored by SANCHIT JAIN's avatar SANCHIT JAIN

key bugs in AI and sample users

parent c1c2e109
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-11-25 09:31
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ARFA_app', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='test',
name='expected_time_for_completion',
field=models.CharField(max_length=10),
),
migrations.AlterField(
model_name='test',
name='max_marks',
field=models.IntegerField(null=True),
),
migrations.AlterField(
model_name='test',
name='start_time',
field=models.CharField(max_length=10),
),
]
# -*- coding: utf-8 -*-
# Generated by Django 1.11.16 on 2018-11-25 11:02
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('ARFA_app', '0002_auto_20181125_0931'),
]
operations = [
migrations.AlterField(
model_name='test',
name='expected_time_for_completion',
field=models.DurationField(blank=True),
),
migrations.AlterField(
model_name='test',
name='max_marks',
field=models.FloatField(null=True),
),
migrations.AlterField(
model_name='test',
name='start_time',
field=models.DateTimeField(),
),
]
......@@ -5,22 +5,22 @@
<table class="table table-hover table-striped " style="text-align: center;">
<thead>
<tr>
<th style="text-align:center;">subject_id</th>
<th style="text-align:center;">username</th>
<th style="text-align:center;"> Name</th>
<th style="text-align:center;">phone_number</th>
<th style="text-align:center;">email_ID</th>
<th style="text-align:center;">username</th>
<th style="text-align:center;">subject_id</th>
</tr>
</thead>
<tbody>
{%for faculty in facultys%}
<tr>
<td><centre>{{faculty.subject_ID_id}}</centre></td>
<td>{{faculty.username}}</td>
<td>{{faculty.name}}</td>
<td>{{faculty.phone_number}}</td>
<td>{{faculty.email_ID}}</td>
<td>{{faculty.username}}</td>
</tr>
<td><centre>{{faculty.subject_ID_id}}</centre></td>
</tr>
{%endfor%}
</tbody>
</table>
......
......@@ -95,21 +95,23 @@ profile
<div class="col-md-1 user-menu-btns">
<div class="btn-group-vertical square" id="responsive">
<a href="#" class="btn btn-block btn-default active">
<i class="fa fa-bell-o fa-3x"></i>
Tests
<i class="fa fa-arrow-alt-circle-right "></i>
</a>
<a href="#" class="btn btn-default">
<i class="fa fa-envelope-o fa-3x"></i>
Q&A
<i class="fa fa-arrow-alt-circle-right"></i>
</a>
<a href="#" class="btn btn-default">
<!-- <a href="#" class="btn btn-default">
<i class="fa fa-laptop fa-3x"></i>
</a>
<a href="#" class="btn btn-default">
<i class="fa fa-cloud-upload fa-3x"></i>
</a>
</a> -->
</div>
</div>
<div class="col-md-4 user-menu user-pad">
<div class="user-menu-content active">
<!-- <div class="user-menu-content active">
<h3>
Summary
</h3>
......@@ -128,7 +130,7 @@ profile
<span class="btn-label"><i class="fa fa-bell-o"></i></span>View all activity</button>
</li>
</ul>
</div>
</div> -->
<div class="user-menu-content">
<h2 class="text-center">
Test Interface
......@@ -136,23 +138,23 @@ profile
<div class="share-links">
<a href="/arfa/create_Test">
<center><button type="button" class="btn btn-lg btn-labeled btn-success" href="#" style="margin-bottom: 15px;">
<span class="btn-label"><i class="fa fa-bell-o"></i></span>CREATE A Test
<span class="btn-label"><i class="fa fa-upload"></i></span>CREATE A Test
</button></center>
</a>
<a href="/arfa/view_personal_Test">
<center><button type="button" class="btn btn-lg btn-labeled btn-primary" href="#" style="margin-bottom: 15px;">
<span class="btn-label"><i class="fa fa-bell-o"></i></span>VIEW MY Test
<span class="btn-label"><i class="fa fa-eye-slash"></i></span>VIEW MY Test
</button></center>
</a>
<a href="/arfa/view_all_Test">
<center><button type="button" class="btn btn-lg btn-labeled btn-info" href="#" style="margin-bottom: 15px;">
<span class="btn-label"><i class="fa fa-bell-o"></i></span>VIEW ALL Test
<span class="btn-label"><i class="fa fa-eye"></i></span>VIEW ALL Test
</button></center>
</a>
</div>
</div>
<div class="user-menu-content">
<!-- <div class="user-menu-content">
<h3>
Trending
</h3>
......@@ -164,7 +166,7 @@ profile
<a href="" rel="tooltip" title="Appreciate"><span class="fa fa-heart-o fa-2x"></span></a>
<a href="" rel="tooltip" title="View"><span class="fa fa-search fa-2x"></span></a>
</div>
<!-- <img src="http://24.media.tumblr.com/273167b30c7af4437dcf14ed894b0768/tumblr_n5waxesawa1st5lhmo1_1280.jpg" class="img-responsive"> -->
<img src="http://24.media.tumblr.com/273167b30c7af4437dcf14ed894b0768/tumblr_n5waxesawa1st5lhmo1_1280.jpg" class="img-responsive">
</div>
<div class="info">
<p class="small" style="text-overflow: ellipsis">An Awesome Title</p>
......@@ -182,7 +184,7 @@ profile
<a href="" rel="tooltip" title="Appreciate"><span class="fa fa-heart-o fa-2x"></span></a>
<a href="" rel="tooltip" title="View"><span class="fa fa-search fa-2x"></span></a>
</div>
<!-- <img src="http://24.media.tumblr.com/282fadab7d782edce9debf3872c00ef1/tumblr_n3tswomqPS1st5lhmo1_1280.jpg" class="img-responsive"> -->
<img src="http://24.media.tumblr.com/282fadab7d782edce9debf3872c00ef1/tumblr_n3tswomqPS1st5lhmo1_1280.jpg" class="img-responsive">
</div>
<div class="info">
<p class="small" style="text-overflow: ellipsis">An Awesome Title</p>
......@@ -194,7 +196,7 @@ profile
</div>
</div>
</div>
</div>
</div> -->
<div class="user-menu-content">
<h2 class="text-center">
Question Interface
......@@ -202,17 +204,17 @@ profile
<div class="share-links">
<a href="/arfa/create_question">
<center><button type="button" class="btn btn-lg btn-labeled btn-success" href="#" style="margin-bottom: 15px;">
<span class="btn-label"><i class="fa fa-bell-o"></i></span>CREATE A QUESTION
<span class="btn-label"><i class="fa fa-upload"></i></span>CREATE A QUESTION
</button></center>
</a>
<a href="/arfa/view_personal_question">
<center><button type="button" class="btn btn-lg btn-labeled btn-primary" href="#" style="margin-bottom: 15px;">
<span class="btn-label"><i class="fa fa-bell-o"></i></span>VIEW MY QUESTIONS
<span class="btn-label"><i class="fa fa-eye-slash"></i></span>VIEW MY QUESTIONS
</button></center>
</a>
<a href="/arfa/view_all_question">
<center><button type="button" class="btn btn-lg btn-labeled btn-info" href="#" style="margin-bottom: 15px;">
<span class="btn-label"><i class="fa fa-bell-o"></i></span>VIEW ALL QUESTIONS
<span class="btn-label"><i class="fa fa-eye"></i></span>VIEW ALL QUESTIONS
</button></center>
</a>
......@@ -221,28 +223,5 @@ profile
</div>
</div>
</div>
<!-- <h1>USER PROFILE You have succesfully logged in {{ name }} and your password is {{ password }}</h1>
<script type="text/javascript">
function loadTest()
{
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("demo").innerHTML =
this.responseText;
}
};
xhttp.open("POST", "", true);
xhttp.send();
}
</script>
<p id = "Test">
</p>
<button type="button" class="btn btn-login float-right">Load Test</button> -->
<h2>
-->
{%endblock%}
......@@ -72,7 +72,7 @@ profile
<h4 class="white"><i class="fa fa-home"></i> address: {{address}}</h4>
{% endif %}
<button type="button" class="btn btn-labeled btn-info" href="#">
<span class="btn-label"><i class="fa fa-edits"></i></span>Update</button>
<span class="btn-label"><i class="fa fa-edit"></i></span>Update</button>
</div>
</div>
<div class="col-md-6 no-pad">
......@@ -88,8 +88,8 @@ profile
<h4>{{tests_given}}</h4>
</div>
<div class="col-md-4 user-pad text-center">
<h3>Questions Solved</h3>
<h4>{{questions_solved}}</h4>
<h3>Q Solved</h3>
<h4>{{question_solved}}</h4>
</div>
<div class="col-md-4 user-pad text-center">
<h3>Best Rank</h3>
......@@ -100,7 +100,7 @@ profile
</div>
<div class="col-md-1 user-menu-btns">
<div class="btn-group-vertical square" id="responsive">
<a href="#" class="btn btn-block btn-default active">
<!-- <a href="#" class="btn btn-block btn-default active">
<i class="fa fa-bell fa-3x"></i>
</a>
<a href="#" class="btn btn-default">
......@@ -108,14 +108,14 @@ profile
</a>
<a href="#" class="btn btn-default">
<i class="fa fa-laptop fa-3x"></i>
</a>
</a> -->
<a href="#" class="btn btn-default">
<i class="fa fa-file-signature fa-3x"></i>
</a>
</div>
</div>
<div class="col-md-4 user-menu user-pad">
<div class="user-menu-content active">
<!-- <div class="user-menu-content active">
<h3>
Recent Interactions
</h3>
......@@ -167,7 +167,7 @@ profile
<a href="" rel="tooltip" title="Appreciate"><span class="fa fa-heart-o fa-2x"></span></a>
<a href="" rel="tooltip" title="View"><span class="fa fa-search fa-2x"></span></a>
</div>
<!-- <img src="http://24.media.tumblr.com/273167b30c7af4437dcf14ed894b0768/tumblr_n5waxesawa1st5lhmo1_1280.jpg" class="img-responsive"> -->
<img src="http://24.media.tumblr.com/273167b30c7af4437dcf14ed894b0768/tumblr_n5waxesawa1st5lhmo1_1280.jpg" class="img-responsive">
</div>
<div class="info">
<p class="small" style="text-overflow: ellipsis">An Awesome Title</p>
......@@ -185,7 +185,7 @@ profile
<a href="" rel="tooltip" title="Appreciate"><span class="fa fa-heart-o fa-2x"></span></a>
<a href="" rel="tooltip" title="View"><span class="fa fa-search fa-2x"></span></a>
</div>
<!-- <img src="http://24.media.tumblr.com/282fadab7d782edce9debf3872c00ef1/tumblr_n3tswomqPS1st5lhmo1_1280.jpg" class="img-responsive"> -->
<img src="http://24.media.tumblr.com/282fadab7d782edce9debf3872c00ef1/tumblr_n3tswomqPS1st5lhmo1_1280.jpg" class="img-responsive">
</div>
<div class="info">
<p class="small" style="text-overflow: ellipsis">An Awesome Title</p>
......@@ -197,7 +197,7 @@ profile
</div>
</div>
</div>
</div>
</div> -->
<div class="user-menu-content">
<h2 class="text-center">
TAKE a TEST
......@@ -206,63 +206,17 @@ profile
<div class="share-links">
<a href="/arfa/studentTestHome">
<center><button type="button" class="btn btn-lg btn-labeled btn-success" href="#" style="margin-bottom: 15px;">
<span class="btn-label"><i class="fa fa-bell-o"></i></span>Take Test
<span class="btn-label"><i class="fa fa-file-import"></i></span>Take Test
</button></center>
</a>
<center><button type="button" class="btn btn-lg btn-labeled btn-warning" href="#">
<!-- <center><button type="button" class="btn btn-lg btn-labeled btn-warning" href="#">
<span class="btn-label"><i class="fa fa-bell-o"></i></span>Resume Test
</button></center>
</button></center> -->
</div>
</div>
</div>
</div>
</div>
<!-- <h1>USER PROFILE You have succesfully logged in {{ name }} and your password is {{ password }}</h1>
<script type="text/javascript">
function loadTest()
{
// {% csrf_token %}
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("demo").innerHTML =
this.responseText;
alert("asjdb");
}
};
xhttp.open("POST", "/arfa/testHome", true);
// alert("alert2");
xhttp.send();
}
</script>
<p id = "demo">
</p>
<button type="button" class="btn btn-login float-right" onclick="loadTest()">Load Test</button> -->
<form action="testHome" method='POST'>
{% csrf_token %}
<button class="btn btn-login float-right" type="submit">Load Test</button>
</form>
</br>
<ol>
<form class="exam-form" method="POST" action="/arfa/result">
{% csrf_token %}
<!-- {{ data }} -->
<input name="testID" value="{{data.testID}}" type="hidden">
{{ username }}
{% for question, options in data.questions.items %}
<li style="font-weight: bold;">Question : {{ question }}</li>
{% for option in options %}
<input type="checkbox" name = "{{option.0}}" value= "{{option.1}}" >{{ option.2 }} </br>
{% endfor %}
{% endfor %}
<button type="submit" class="btn btn-login float-right">Submit</button>
</form>
</ol>
{%endblock%}
......@@ -83,7 +83,7 @@
</div>
<div class="col-md-6">
<div class="form-group">
<input type="text" class="form-control" placeholder="Chose a username *" value="" name="username" required/>
<input type="text" class="form-control" placeholder="Choose a username *" value="" name="username" required/>
</div>
<div class="form-group">
<input type="password" pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}" class="form-control" placeholder="Password *" value="" id="txtPassword" name="password" required/>
......@@ -123,7 +123,7 @@
<input type="text" minlength="1" maxlength="1" class="form-control" placeholder="Subject (M/P/C)*" value="" name="subject_ID" id="sub" />
</div>
<div class="form-group">
<input type="text" class="form-control" placeholder="Chose a username *" value="" name="username" required/>
<input type="text" class="form-control" placeholder="Choose a username *" value="" name="username" required/>
</div>
<div class="form-group">
<input type="password" pattern="(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{8,}" class="form-control" placeholder="Password *" value="" id="_txtPassword" name="password" required/>
......
......@@ -5,21 +5,21 @@
<table class="table table-hover table-striped " style="text-align: center;">
<thead>
<tr>
<th style="text-align:center;">roll_no</th>
<th style="text-align:center;">username</th>
<th style="text-align:center;"> Name</th>
<th style="text-align:center;">phone_number</th>
<th style="text-align:center;">email_ID</th>
<th style="text-align:center;">username</th>
<th style="text-align:center;">Standard</th>
</tr>
</thead>
<tbody>
{%for student in students%}
<tr>
<td><centre>{{student.roll_no}}</centre></td>
<td><centre>{{student.username}}</centre></td>
<td>{{student.name}}</td>
<td>{{student.phone_number}}</td>
<td>{{student.email_ID}}</td>
<td>{{student.username}}</td>
<td>{{student.Standard}}</td>
</tr>
{%endfor%}
</tbody>
......
......@@ -69,7 +69,7 @@ def reg(request):
# TODO: create a subsitute table which records student and teacher applications and an Admin must approve it and set salary for the faculty or other relavant stuff
if(request.method=="POST"):
role=request.POST['role']
data={'username': request.POST['username'], 'name':request.POST['name'],'email_ID': request.POST['email_ID'],'address':request.POST['email_ID'],'password':request.POST['password'],'phone_number':request.POST['phone_number']}
data={'username': request.POST['username'], 'name':request.POST['name'],'email_ID': request.POST['email_ID'],'address':request.POST['address'],'password':request.POST['password'],'phone_number':request.POST['phone_number']}
if(role=="Student"):
print "Student with name "+ data['name']+" registered"
......@@ -93,10 +93,11 @@ def students(request):
args2=request.session.get('args',None)
if args2!=None:
args.update(args2)
tests_given=models.Takes.objects.filter(student=args['user']).count()
question_solved=models.Responses.objects.filter(student=args['users']).annotate("q_ID").count()
args3={'tests_given':tests_given,'question_solved':question_solved}
args.update(args3)
tests_given=models.Takes.objects.filter(student=args2['username']).count()
question_solved=9
# question_solved=models.Responses.objects.filter(student_ID=args2['username']).annotate(myalias="q_ID").count()
args3={'tests_given':tests_given,'question_solved':question_solved}
args.update(args3)
print "Rendering All students Page"
return render(request,'ARFA_app/students.html',args)
......@@ -107,10 +108,10 @@ def faculty(request):
args2=request.session.get('args',None)
if args2!=None:
args.update(args2)
personal_questions=models.Question.objects.filter(faculty=args['user']).count()
test_created=models.Created_BY.objects.filter(faculty=args['user']).count()
args3={'personal_questions':personal_questions,'test_created':test_created}
args.update(args3)
personal_questions=models.Question.objects.filter(faculty=args2['username']).count()
test_created=models.Created_BY.objects.filter(faculty=args2['username']).count()
args3={'personal_questions':personal_questions,'test_created':test_created}
args.update(args3)
print "Rendering All faculty Page"
return render(request,'ARFA_app/faculty.html',args)
......@@ -144,7 +145,9 @@ def profile(request):
if(request.session.get('role',None)=="student"):
args=request.session.get('args',None)
tests_given=models.Takes.objects.filter(student=args['username']).count()
question_solved=models.Responses.objects.filter(student=args['username']).annotate("q_ID").count()
question_solved=9
# question_solved=models.Responses.objects.filter(student_ID=args['username']).annotate(myalias="q_ID").count()
args3={'tests_given':tests_given,'question_solved':question_solved}
args.update(args3)
......@@ -182,15 +185,16 @@ def profile(request):
}
request.session['args']=args
if(authenticated['role']=="student"):
tests_given=models.Takes.objects.filter(student=args['user']).count()
question_solved=models.Responses.objects.filter(student=args['users']).annotate("q_ID").count()
tests_given=models.Takes.objects.filter(student=args['username']).count()
question_solved=9
# question_solved=models.Responses.objects.filter(student_ID=args['username']).annotate(myalias="q_ID").count()
args3={'tests_given':tests_given,'question_solved':question_solved}
args.update(args3)
# print("session before render "+str(request.session.get('session',None)))
return render(request,'ARFA_app/home.html',args)
else:
personal_questions=models.Question.objects.filter(faculty=args['user']).count()
test_created=models.Created_BY.objects.filter(faculty=args['user']).count()
personal_questions=models.Question.objects.filter(faculty=args['username']).count()
test_created=models.Created_BY.objects.filter(faculty=args['username']).count()
args3={'personal_questions':personal_questions,'test_created':test_created}
args.update(args3)
......
insert into "ARFA_app_subject"("subject_ID","subject") values ('P','physics'),('Ch','chemistry'),('M','Maths');
insert into "ARFA_app_student"("name","phone_number","email_ID","address","username","password") values ('raj','9999999999','raj@gmail.com','street x avenue y','raj23','raj');
insert into "ARFA_app_faculty"("name","phone_number","email_ID","address","username","password","salary","subject_ID_id") values ('mathur','8888888888','mathur@gmail.com','street m avenue n','mathur','mathur','1000000','P');
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