Commit 7013fd64 authored by Rahul-chunduru's avatar Rahul-chunduru

time counter minors

parents e3b5d79e 9eb52c1a
......@@ -32,4 +32,4 @@ VISIBILITY_CHOICES= ('1980', '1981', '1982')
class TestForm(forms.ModelForm):
class Meta:
model = Test
exclude = ['test_ID', 'ownsership']
\ No newline at end of file
exclude = ['test_ID', 'ownership']
\ No newline at end of file
......@@ -7,18 +7,11 @@
Create Test
{%endblock%}
{%block head%}
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML">
MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}});
</script>
{%endblock%}
{%block body%}
<h1> You CAN CREATE A Test HERE prof {{username}}</h1>
<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">
......
......@@ -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>
......
......@@ -56,14 +56,21 @@ profile
<div class="col-md-6 no-pad">
<div class="user-pad">
<h3>Welcome back, {{name}}</h3>
<h4 class="white"><i class="fa fa-check-circle"></i> contact:{{phone_number}}</h4>
<h4 class="white"><i class="fa fa-check-circle"></i>ID: {{email_ID}}</h4>
<h4 class="white"><i class="fa fa-twitter"></i>address: {{address}}</h4>
{% if phone_number %}
<h4 class="white"><i class="fa fa-phone"></i> contact:{{phone_number}}</h4>
{% endif%}
{% if email_ID%}
<h4 class="white"><i class="fa fa-mail-bulk"></i> ID: {{email_ID}}</h4>
{% endif %}
{% if address%}
<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-pencil"></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">
<!-- <i class="fa fa-user fa-10x" style="transform: translate(50%,30%);"></i> -->
<div class="user-image">
{% load static %}
<img src="{% static 'ARFA_app/prof_male.png' %}" style="width: 100%" class="img-responsive thumbnail">
......@@ -72,37 +79,39 @@ profile
</div>
<div class="row overview">
<div class="col-md-4 user-pad text-center">
<h3>Tests Given</h3>
<h4>2,784</h4>
<h3>Tests Created</h3>
<h4>{{ test_created}}</h4>
</div>
<div class="col-md-4 user-pad text-center">
<h3>Rank</h3>
<h4>456</h4>
</div>
<div class="col-md-4 user-pad text-center">
<h3>Questions Solved</h3>
<h4>4,901</h4>
<h3>Personal Questions</h3>
<h4>{{ personal_questions}}</h4>
</div>
<!-- <div class="col-md-4 user-pad text-center">
<h3>Questions Accessible</h3>
<h4>{{ questions_accessible }}</h4>
</div> -->
</div>
</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">
<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>
......@@ -121,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
......@@ -129,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>
......@@ -157,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>
......@@ -175,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>
......@@ -187,7 +196,7 @@ profile
</div>
</div>
</div>
</div>
</div> -->
<div class="user-menu-content">
<h2 class="text-center">
Question Interface
......@@ -195,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>
......@@ -214,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%}
......@@ -62,11 +62,17 @@ profile
<div class="col-md-6 no-pad">
<div class="user-pad">
<h3>Welcome back, {{name}}</h3>
<h4 class="white"><i class="fa fa-check-circle"></i> contact:{{phone_number}}</h4>
<h4 class="white"><i class="fa fa-check-circle"></i>ID: {{email_ID}}</h4>
<h4 class="white"><i class="fa fa-home"></i>address: {{address}}</h4>
{% if phone_number %}
<h4 class="white"><i class="fa fa-phone"></i> contact:{{phone_number}}</h4>
{% endif%}
{% if email_ID%}
<h4 class="white"><i class="fa fa-mail-bulk"></i> ID: {{email_ID}}</h4>
{% endif %}
{% if address%}
<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-pencil"></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">
......@@ -79,21 +85,22 @@ profile
<div class="row overview">
<div class="col-md-4 user-pad text-center">
<h3>Tests Given</h3>
<h4>2,784</h4>
<h4>{{tests_given}}</h4>
</div>
<div class="col-md-4 user-pad text-center">
<h3>Rank</h3>
<h4>456</h4>
<h3>Q Solved</h3>
<h4>{{question_solved}}</h4>
</div>
<div class="col-md-4 user-pad text-center">
<h3>Questions Solved</h3>
<h4>4,901</h4>
<h3>Best Rank</h3>
<!-- TODO: Find rank relative to other students -->
<h4>5</h4>
</div>
</div>
</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">
......@@ -101,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>
......@@ -160,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>
......@@ -178,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>
......@@ -190,7 +197,7 @@ profile
</div>
</div>
</div>
</div>
</div> -->
<div class="user-menu-content">
<h2 class="text-center">
TAKE a TEST
......@@ -199,12 +206,12 @@ 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>
......@@ -236,5 +243,6 @@ profile
{%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,6 +93,11 @@ def students(request):
args2=request.session.get('args',None)
if args2!=None:
args.update(args2)
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)
......@@ -103,6 +108,10 @@ def faculty(request):
args2=request.session.get('args',None)
if args2!=None:
args.update(args2)
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)
......@@ -135,11 +144,23 @@ def profile(request):
print "Detected A session "
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=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 "rendering student home for student "+args['name']
return render(request,'ARFA_app/home.html',args)
else:
args=request.session.get('args',None)
print "rendering student home for faculty "+args['name']
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)
print "rendering faculty home for faculty "+args['name']
return render(request,'ARFA_app/faculty_home.html',args)
else:
print "No session Detected"
......@@ -152,7 +173,6 @@ def profile(request):
else:
request.session['username'] = args['user']
request.session['session'] = True
request.session.get('role',None)
request.session['role']=authenticated['role']
args={
'name':authenticated["object"].name,
......@@ -165,9 +185,19 @@ def profile(request):
}
request.session['args']=args
if(authenticated['role']=="student"):
print("session before render "+str(request.session.get('session',None)))
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['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)
return render(request,'ARFA_app/faculty_home.html',args)
else:
......
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