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 @@ ...@@ -5,22 +5,22 @@
<table class="table table-hover table-striped " style="text-align: center;"> <table class="table table-hover table-striped " style="text-align: center;">
<thead> <thead>
<tr> <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;"> Name</th>
<th style="text-align:center;">phone_number</th> <th style="text-align:center;">phone_number</th>
<th style="text-align:center;">email_ID</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> </tr>
</thead> </thead>
<tbody> <tbody>
{%for faculty in facultys%} {%for faculty in facultys%}
<tr> <tr>
<td><centre>{{faculty.subject_ID_id}}</centre></td> <td>{{faculty.username}}</td>
<td>{{faculty.name}}</td> <td>{{faculty.name}}</td>
<td>{{faculty.phone_number}}</td> <td>{{faculty.phone_number}}</td>
<td>{{faculty.email_ID}}</td> <td>{{faculty.email_ID}}</td>
<td>{{faculty.username}}</td> <td><centre>{{faculty.subject_ID_id}}</centre></td>
</tr> </tr>
{%endfor%} {%endfor%}
</tbody> </tbody>
</table> </table>
......
...@@ -95,21 +95,23 @@ profile ...@@ -95,21 +95,23 @@ profile
<div class="col-md-1 user-menu-btns"> <div class="col-md-1 user-menu-btns">
<div class="btn-group-vertical square" id="responsive"> <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-o fa-3x"></i> Tests
<i class="fa fa-arrow-alt-circle-right "></i>
</a> </a>
<a href="#" class="btn btn-default"> <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>
<a href="#" class="btn btn-default"> <!-- <a href="#" class="btn btn-default">
<i class="fa fa-laptop fa-3x"></i> <i class="fa fa-laptop fa-3x"></i>
</a> </a>
<a href="#" class="btn btn-default"> <a href="#" class="btn btn-default">
<i class="fa fa-cloud-upload fa-3x"></i> <i class="fa fa-cloud-upload fa-3x"></i>
</a> </a> -->
</div> </div>
</div> </div>
<div class="col-md-4 user-menu user-pad"> <div class="col-md-4 user-menu user-pad">
<div class="user-menu-content active"> <!-- <div class="user-menu-content active">
<h3> <h3>
Summary Summary
</h3> </h3>
...@@ -128,7 +130,7 @@ profile ...@@ -128,7 +130,7 @@ profile
<span class="btn-label"><i class="fa fa-bell-o"></i></span>View all activity</button> <span class="btn-label"><i class="fa fa-bell-o"></i></span>View all activity</button>
</li> </li>
</ul> </ul>
</div> </div> -->
<div class="user-menu-content"> <div class="user-menu-content">
<h2 class="text-center"> <h2 class="text-center">
Test Interface Test Interface
...@@ -136,23 +138,23 @@ profile ...@@ -136,23 +138,23 @@ profile
<div class="share-links"> <div class="share-links">
<a href="/arfa/create_Test"> <a href="/arfa/create_Test">
<center><button type="button" class="btn btn-lg btn-labeled btn-success" href="#" style="margin-bottom: 15px;"> <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> </button></center>
</a> </a>
<a href="/arfa/view_personal_Test"> <a href="/arfa/view_personal_Test">
<center><button type="button" class="btn btn-lg btn-labeled btn-primary" href="#" style="margin-bottom: 15px;"> <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> </button></center>
</a> </a>
<a href="/arfa/view_all_Test"> <a href="/arfa/view_all_Test">
<center><button type="button" class="btn btn-lg btn-labeled btn-info" href="#" style="margin-bottom: 15px;"> <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> </button></center>
</a> </a>
</div> </div>
</div> </div>
<div class="user-menu-content"> <!-- <div class="user-menu-content">
<h3> <h3>
Trending Trending
</h3> </h3>
...@@ -164,7 +166,7 @@ profile ...@@ -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="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> <a href="" rel="tooltip" title="View"><span class="fa fa-search fa-2x"></span></a>
</div> </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>
<div class="info"> <div class="info">
<p class="small" style="text-overflow: ellipsis">An Awesome Title</p> <p class="small" style="text-overflow: ellipsis">An Awesome Title</p>
...@@ -182,7 +184,7 @@ profile ...@@ -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="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> <a href="" rel="tooltip" title="View"><span class="fa fa-search fa-2x"></span></a>
</div> </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>
<div class="info"> <div class="info">
<p class="small" style="text-overflow: ellipsis">An Awesome Title</p> <p class="small" style="text-overflow: ellipsis">An Awesome Title</p>
...@@ -194,7 +196,7 @@ profile ...@@ -194,7 +196,7 @@ profile
</div> </div>
</div> </div>
</div> </div>
</div> </div> -->
<div class="user-menu-content"> <div class="user-menu-content">
<h2 class="text-center"> <h2 class="text-center">
Question Interface Question Interface
...@@ -202,17 +204,17 @@ profile ...@@ -202,17 +204,17 @@ profile
<div class="share-links"> <div class="share-links">
<a href="/arfa/create_question"> <a href="/arfa/create_question">
<center><button type="button" class="btn btn-lg btn-labeled btn-success" href="#" style="margin-bottom: 15px;"> <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> </button></center>
</a> </a>
<a href="/arfa/view_personal_question"> <a href="/arfa/view_personal_question">
<center><button type="button" class="btn btn-lg btn-labeled btn-primary" href="#" style="margin-bottom: 15px;"> <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> </button></center>
</a> </a>
<a href="/arfa/view_all_question"> <a href="/arfa/view_all_question">
<center><button type="button" class="btn btn-lg btn-labeled btn-info" href="#" style="margin-bottom: 15px;"> <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> </button></center>
</a> </a>
...@@ -221,28 +223,5 @@ profile ...@@ -221,28 +223,5 @@ profile
</div> </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()
{
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%} {%endblock%}
...@@ -72,7 +72,7 @@ profile ...@@ -72,7 +72,7 @@ profile
<h4 class="white"><i class="fa fa-home"></i> address: {{address}}</h4> <h4 class="white"><i class="fa fa-home"></i> address: {{address}}</h4>
{% endif %} {% endif %}
<button type="button" class="btn btn-labeled btn-info" href="#"> <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> </div>
<div class="col-md-6 no-pad"> <div class="col-md-6 no-pad">
...@@ -88,8 +88,8 @@ profile ...@@ -88,8 +88,8 @@ profile
<h4>{{tests_given}}</h4> <h4>{{tests_given}}</h4>
</div> </div>
<div class="col-md-4 user-pad text-center"> <div class="col-md-4 user-pad text-center">
<h3>Questions Solved</h3> <h3>Q Solved</h3>
<h4>{{questions_solved}}</h4> <h4>{{question_solved}}</h4>
</div> </div>
<div class="col-md-4 user-pad text-center"> <div class="col-md-4 user-pad text-center">
<h3>Best Rank</h3> <h3>Best Rank</h3>
...@@ -100,7 +100,7 @@ profile ...@@ -100,7 +100,7 @@ profile
</div> </div>
<div class="col-md-1 user-menu-btns"> <div class="col-md-1 user-menu-btns">
<div class="btn-group-vertical square" id="responsive"> <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> <i class="fa fa-bell fa-3x"></i>
</a> </a>
<a href="#" class="btn btn-default"> <a href="#" class="btn btn-default">
...@@ -108,14 +108,14 @@ profile ...@@ -108,14 +108,14 @@ profile
</a> </a>
<a href="#" class="btn btn-default"> <a href="#" class="btn btn-default">
<i class="fa fa-laptop fa-3x"></i> <i class="fa fa-laptop fa-3x"></i>
</a> </a> -->
<a href="#" class="btn btn-default"> <a href="#" class="btn btn-default">
<i class="fa fa-file-signature fa-3x"></i> <i class="fa fa-file-signature fa-3x"></i>
</a> </a>
</div> </div>
</div> </div>
<div class="col-md-4 user-menu user-pad"> <div class="col-md-4 user-menu user-pad">
<div class="user-menu-content active"> <!-- <div class="user-menu-content active">
<h3> <h3>
Recent Interactions Recent Interactions
</h3> </h3>
...@@ -167,7 +167,7 @@ profile ...@@ -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="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> <a href="" rel="tooltip" title="View"><span class="fa fa-search fa-2x"></span></a>
</div> </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>
<div class="info"> <div class="info">
<p class="small" style="text-overflow: ellipsis">An Awesome Title</p> <p class="small" style="text-overflow: ellipsis">An Awesome Title</p>
...@@ -185,7 +185,7 @@ profile ...@@ -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="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> <a href="" rel="tooltip" title="View"><span class="fa fa-search fa-2x"></span></a>
</div> </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>
<div class="info"> <div class="info">
<p class="small" style="text-overflow: ellipsis">An Awesome Title</p> <p class="small" style="text-overflow: ellipsis">An Awesome Title</p>
...@@ -197,7 +197,7 @@ profile ...@@ -197,7 +197,7 @@ profile
</div> </div>
</div> </div>
</div> </div>
</div> </div> -->
<div class="user-menu-content"> <div class="user-menu-content">
<h2 class="text-center"> <h2 class="text-center">
TAKE a TEST TAKE a TEST
...@@ -206,63 +206,17 @@ profile ...@@ -206,63 +206,17 @@ profile
<div class="share-links"> <div class="share-links">
<a href="/arfa/studentTestHome"> <a href="/arfa/studentTestHome">
<center><button type="button" class="btn btn-lg btn-labeled btn-success" href="#" style="margin-bottom: 15px;"> <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> </button></center>
</a> </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 <span class="btn-label"><i class="fa fa-bell-o"></i></span>Resume Test
</button></center> </button></center> -->
</div> </div>
</div> </div>
</div> </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%} {%endblock%}
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<div class="form-group"> <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>
<div class="form-group"> <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/> <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 @@ ...@@ -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" /> <input type="text" minlength="1" maxlength="1" class="form-control" placeholder="Subject (M/P/C)*" value="" name="subject_ID" id="sub" />
</div> </div>
<div class="form-group"> <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>
<div class="form-group"> <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/> <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 @@ ...@@ -5,21 +5,21 @@
<table class="table table-hover table-striped " style="text-align: center;"> <table class="table table-hover table-striped " style="text-align: center;">
<thead> <thead>
<tr> <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;"> Name</th>
<th style="text-align:center;">phone_number</th> <th style="text-align:center;">phone_number</th>
<th style="text-align:center;">email_ID</th> <th style="text-align:center;">email_ID</th>
<th style="text-align:center;">username</th> <th style="text-align:center;">Standard</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
{%for student in students%} {%for student in students%}
<tr> <tr>
<td><centre>{{student.roll_no}}</centre></td> <td><centre>{{student.username}}</centre></td>
<td>{{student.name}}</td> <td>{{student.name}}</td>
<td>{{student.phone_number}}</td> <td>{{student.phone_number}}</td>
<td>{{student.email_ID}}</td> <td>{{student.email_ID}}</td>
<td>{{student.username}}</td> <td>{{student.Standard}}</td>
</tr> </tr>
{%endfor%} {%endfor%}
</tbody> </tbody>
......
...@@ -69,7 +69,7 @@ def reg(request): ...@@ -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 # 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"): if(request.method=="POST"):
role=request.POST['role'] 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"): if(role=="Student"):
print "Student with name "+ data['name']+" registered" print "Student with name "+ data['name']+" registered"
...@@ -93,10 +93,11 @@ def students(request): ...@@ -93,10 +93,11 @@ def students(request):
args2=request.session.get('args',None) args2=request.session.get('args',None)
if args2!=None: if args2!=None:
args.update(args2) args.update(args2)
tests_given=models.Takes.objects.filter(student=args['user']).count() tests_given=models.Takes.objects.filter(student=args2['username']).count()
question_solved=models.Responses.objects.filter(student=args['users']).annotate("q_ID").count() question_solved=9
args3={'tests_given':tests_given,'question_solved':question_solved} # question_solved=models.Responses.objects.filter(student_ID=args2['username']).annotate(myalias="q_ID").count()
args.update(args3) args3={'tests_given':tests_given,'question_solved':question_solved}
args.update(args3)
print "Rendering All students Page" print "Rendering All students Page"
return render(request,'ARFA_app/students.html',args) return render(request,'ARFA_app/students.html',args)
...@@ -107,10 +108,10 @@ def faculty(request): ...@@ -107,10 +108,10 @@ def faculty(request):
args2=request.session.get('args',None) args2=request.session.get('args',None)
if args2!=None: if args2!=None:
args.update(args2) args.update(args2)
personal_questions=models.Question.objects.filter(faculty=args['user']).count() personal_questions=models.Question.objects.filter(faculty=args2['username']).count()
test_created=models.Created_BY.objects.filter(faculty=args['user']).count() test_created=models.Created_BY.objects.filter(faculty=args2['username']).count()
args3={'personal_questions':personal_questions,'test_created':test_created} args3={'personal_questions':personal_questions,'test_created':test_created}
args.update(args3) args.update(args3)
print "Rendering All faculty Page" print "Rendering All faculty Page"
return render(request,'ARFA_app/faculty.html',args) return render(request,'ARFA_app/faculty.html',args)
...@@ -144,7 +145,9 @@ def profile(request): ...@@ -144,7 +145,9 @@ def profile(request):
if(request.session.get('role',None)=="student"): if(request.session.get('role',None)=="student"):
args=request.session.get('args',None) args=request.session.get('args',None)
tests_given=models.Takes.objects.filter(student=args['username']).count() 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} args3={'tests_given':tests_given,'question_solved':question_solved}
args.update(args3) args.update(args3)
...@@ -182,15 +185,16 @@ def profile(request): ...@@ -182,15 +185,16 @@ def profile(request):
} }
request.session['args']=args request.session['args']=args
if(authenticated['role']=="student"): if(authenticated['role']=="student"):
tests_given=models.Takes.objects.filter(student=args['user']).count() tests_given=models.Takes.objects.filter(student=args['username']).count()
question_solved=models.Responses.objects.filter(student=args['users']).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} args3={'tests_given':tests_given,'question_solved':question_solved}
args.update(args3) args.update(args3)
# print("session before render "+str(request.session.get('session',None))) # print("session before render "+str(request.session.get('session',None)))
return render(request,'ARFA_app/home.html',args) return render(request,'ARFA_app/home.html',args)
else: else:
personal_questions=models.Question.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['user']).count() test_created=models.Created_BY.objects.filter(faculty=args['username']).count()
args3={'personal_questions':personal_questions,'test_created':test_created} args3={'personal_questions':personal_questions,'test_created':test_created}
args.update(args3) args.update(args3)
......
insert into "ARFA_app_subject"("subject_ID","subject") values ('P','physics'),('Ch','chemistry'),('M','Maths'); 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