Commit 917d940b authored by CHINTHAREDDY SAI CHARITH REDDY's avatar CHINTHAREDDY SAI CHARITH REDDY

Merge branch 'master' of https://git.cse.iitb.ac.in/ARFA/ARFA

merge
parents 4c2a45ab 6d27c864
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "enter program name, for example ${workspaceFolder}/a.out",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
\ No newline at end of file
......@@ -31,5 +31,9 @@ VISIBILITY_CHOICES= ('1980', '1981', '1982')
class TestForm(forms.ModelForm):
class Meta:
model = Test
exclude = ['test_ID', 'ownsership']
\ No newline at end of file
model = Test
widgets = {
'expected_time_for_completion': forms.TimeInput(attrs={'type':'time'}),
'start_time': forms.DateInput(attrs={'type':'datetime-local'}),
}
exclude = ['test_ID', 'ownership']
\ No newline at end of file
This diff is collapsed.
# -*- 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(),
),
]
......@@ -30,7 +30,7 @@ class Test(models.Model):
visibility_student = models.CharField(max_length=20)
ownership = models.CharField(max_length=20)
expected_time_for_completion = models.DurationField(blank=True)
start_time = models.DateTimeField(auto_now=False, auto_now_add=False)
start_time = models.DateTimeField(auto_now=False, auto_now_add=False,blank=False)
max_marks = models.IntegerField(null=True)
# class TestQuestions(models.Model):
......@@ -86,12 +86,16 @@ class Question(models.Model):
difficulty_observed = models.CharField(max_length=20)
question_text = models.CharField(max_length=1000)
image_link = models.CharField(max_length=200)
num_appeared = models.IntegerField
num_correct = models.IntegerField
num_appeared = models.IntegerField(default=0)
num_correct = models.IntegerField(default=0)
visibility = models.CharField(max_length=20)
ownership = models.CharField(max_length=20)
class QuestionImage(models.Model):
image = models.FileField(upload_to='QuestionImages/' )
question = models.ForeignKey('Question' , on_delete=models.CASCADE)
imageDesc = models.CharField(max_length=100)
orderNum = models.IntegerField(default=1)
class Takes(models.Model):
......@@ -151,4 +155,4 @@ class ContactUs(models.Model):
phone_number = models.CharField(max_length=10)
email_ID=models.CharField(max_length=200)
text = models.CharField(max_length=200)
\ No newline at end of file
.myh3 {
font-family: "Avant Garde", Avantgarde, "Century Gothic", CenturyGothic, "AppleGothic", sans-serif;
font-size: 50px;
padding: 80px 50px;
text-align: center;
text-transform: uppercase;
text-rendering: optimizeLegibility;
}
.elegantshd {
color: #131313;
background-color: #e7e5e4;
letter-spacing: .15em;
text-shadow: 1px -1px 0 #767676, -1px 2px 1px #737272, -2px 4px 1px #767474, -3px 6px 1px #787777, -4px 8px 1px #7b7a7a, -5px 10px 1px #7f7d7d, -6px 12px 1px #828181, -7px 14px 1px #868585, -8px 16px 1px #8b8a89, -9px 18px 1px #8f8e8d, -10px 20px 1px #949392, -11px 22px 1px #999897, -12px 24px 1px #9e9c9c, -13px 26px 1px #a3a1a1, -14px 28px 1px #a8a6a6, -15px 30px 1px #adabab, -16px 32px 1px #b2b1b0, -17px 34px 1px #b7b6b5, -18px 36px 1px #bcbbba, -19px 38px 1px #c1bfbf, -20px 40px 1px #c6c4c4, -21px 42px 1px #cbc9c8, -22px 44px 1px #cfcdcd, -23px 46px 1px #d4d2d1, -24px 48px 1px #d8d6d5, -25px 50px 1px #dbdad9, -26px 52px 1px #dfdddc, -27px 54px 1px #e2e0df, -28px 56px 1px #e4e3e2;
}
.deepshd {
color: #e0dfdc;
background-color: #333;
letter-spacing: .1em;
text-shadow: 0 -1px 0 #fff, 0 1px 0 #2e2e2e, 0 2px 0 #2c2c2c, 0 3px 0 #2a2a2a, 0 4px 0 #282828, 0 5px 0 #262626, 0 6px 0 #242424, 0 7px 0 #222, 0 8px 0 #202020, 0 9px 0 #1e1e1e, 0 10px 0 #1c1c1c, 0 11px 0 #1a1a1a, 0 12px 0 #181818, 0 13px 0 #161616, 0 14px 0 #141414, 0 15px 0 #121212, 0 22px 30px rgba(0, 0, 0, 0.9);
}
.xbootstrap {
color: #202020;
background-color: #2d2d2d;
letter-spacing: .1em;
text-shadow: -1px -1px 1px #111, 2px 2px 1px #363636;
}
.retroshd {
color: #2c2c2c;
background-color: #d5d5d5;
letter-spacing: .05em;
text-shadow: 4px 4px 0px #d5d5d5, 7px 7px 0px rgba(0, 0, 0, 0.2);
}
.retroshd:hover {
text-decoration: none;
}
\ No newline at end of file
......@@ -7,18 +7,10 @@
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">
......@@ -28,7 +20,7 @@ Create Test
<!-- <ul> -->
<form method="POST" action="create_Test">
{% csrf_token %}
{{ TestForm }}
{{ TestForm.as_p }}
{{TestForm.errors}}
{{TestForm.non_field_errors}}
{%for question in questions%}
......
......@@ -167,7 +167,10 @@ function prevTab(elem) {
// console.log(result);
// }
// }) ;
// console.log( document.getElementById("upload").value ) ;
// document.getElementById("imageForm").submit();
// console.log("still") ;
$.ajax({
url : "add_question",
type : "POST",
......@@ -196,6 +199,10 @@ function prevTab(elem) {
});
}
function uploadImage()
{
var data = new FormData($('form').get(0));
}
......@@ -299,10 +306,22 @@ Create Question
<li><button type="button" class="btn btn-default next-step" onclick="document.getElementById('l4').click() ;">Skip</button></li>
<li><button type="button" class="btn btn-primary btn-info-full next-step" onclick="step3()">Save and continue</button></li>
</ul>
<!-- <form method="post" action="addimage" enctype="multipart/form-data" id="imageForm">
{% csrf_token %}
<label for="upload">
<span class="glyphicon glyphicon-folder-open" aria-hidden="true"></span>
<input type="file" id="upload" style="display:none">
</label><br>
<button onclick="post()" class="btn btn-primary btn-info-full" >Post the Question</button>
</form> -->
</div>
<div class="tab-pane" role="tabpanel" id="complete">
<h3>Complete</h3>
<p>You have successfully completed all steps. Here's the preview</p>
<ul class="list-inline pull-right">
<li><button type="button" class="btn btn-default prev-step">Previous</button></li>
<li><button type="button" class="btn btn-primary btn-info-full next-step" onclick="post()">Post </button></li>
......
......@@ -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>
......@@ -234,28 +241,8 @@ profile
</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%}
......@@ -3,23 +3,72 @@
{%endblock%}
{%block title%}
{{testName}}
Test {{testName.test_name}}
{%endblock%}
{%block body%}
<div>
<div style="float: right;">
Total Time :<b > {{total_time.hours}} {{total_time.minutes}} </b>
<p> Max Marks. <b>{{max_marks}}</b> </p>
<div id="Timer" style="border-style: solid; text-align: center;"></div>
</div>
<h2 align="center" style=" text-decoration: underline;"><b> {{testName.test_name}} </b> </h2>
</div>
<script>
// Set the date we're counting down to
var countDownDate = new Date( {{ end_time }} );
countDownDate.setMonth(countDownDate.getMonth() - 1) ;
console.log(countDownDate) ;
// Update the count down every 1 second
var x = setInterval(function() {
// Get todays date and time
var now = new Date().getTime();
// Find the distance between now and the count down date
var distance = countDownDate - now;
console.log(distance) ;
// Time calculations for days, hours, minutes and seconds
var days = Math.floor(distance / (1000 * 60 * 60 * 24));
var hours = Math.floor((distance % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = Math.floor((distance % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((distance % (1000 * 60)) / 1000);
// Output the result in an element with id="demo"
document.getElementById("Timer").innerHTML = days + "d " + hours + "h "
+ minutes + "m " + seconds + "s ";
// If the count down is over, write some text
if (distance < 0) {
clearInterval(x);
document.getElementById("Timer").innerHTML = "EXPIRED";
}
}, 1000);
</script>
<div style="margin-left: 5%; margin-top: 10%">
<ol>
<font size="3">
<form class="exam-form" method="POST" action="/arfa/result">
<p style="margin-right: 5%"> <b> Questions </b></p>
{% csrf_token %}
<!-- {{ data }} -->
<input name="testID" value="{{testID}}" type="hidden">
<input name="testID" value="{{testID}}" type="hidden" >
{% for question, options in questions.items %}
<li style="font-weight: bold;">Question : {{ question }}</li>
<div class="row" style="margin-top: 10px; margin-bottom: 10px">
<li style="font-weight: bold;" > {{ question }}</li>
{% for option in options %}
<input type="checkbox" name = "{{option.0}}" value= "{{option.1}}" >{{ option.2 }} </br>
<input type="checkbox" name = "{{option.0}}" value= "{{option.1}}" > {{ option.2 }} </br>
{% endfor %}
</div>
{% endfor %}
<button type="submit" class="btn btn-login float-right">Submit</button>
<button type="submit" class="btn btn-login" style="float: right;">Submit</button>
</form>
</font>
</ol>
<br><br><br><br><br><br>
</div>
{%endblock%}
\ No newline at end of file
......@@ -6,6 +6,17 @@
Logout
{%endblock%}
{%block head%}
{% load static %}
<link rel="stylesheet" href="{% static 'ARFA_app/logout.css' %}" type="text/css">
{%endblock%}
{%block body%}
<h3 class="myh3 deepshd"> You have succesfully logged out </h3>
<!-- <div class="container">
<centre>
<h1> You have succesfully logged out</h1>
</centre>
</div> -->
{%endblock%}
\ No newline at end of file
......@@ -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>
......
......@@ -5,7 +5,6 @@ urlpatterns=[
url(r'^$',views.login),
url(r'^profile',views.profile),
url(r'^logout',views.logout),
url(r'^testHome', views.testHome),
url(r'^result', views.result),
url(r'^create_question',views.create_question),
......@@ -22,7 +21,8 @@ urlpatterns=[
url(r'^faculty',views.faculty),
url(r'^ContactUs',views.ContactUs),
url(r'^send_mess',views.send_mess),
url(r'^add_question',views.add_question),
url(r'^add_question',views.add_question),
url(r'^addimage',views.addimage),
url(r'^register',views.register),
url(r'^reg',views.reg),
url(r'^studentTestHome', views.studentTestHome),
......
......@@ -9,6 +9,7 @@ from .models import Question
from .models import Options
from .models import Student
from .models import Evaluation
from .models import Takes
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse
......@@ -16,25 +17,45 @@ from django.views.decorators.cache import cache_control
import json
from django.db import connection
from django.db import IntegrityError
from django.db.models import F
from pprint import pprint
import datetime
def evaluate(responses, otherData):
"""responses contains a list of dicts of the form {q_ID: [option1, option2 ..]}
other data contains any other data necessary for evaluation such as testID and studentID"""
#create evaluation object
evalObj = Evaluation()
if len(responses) == 0:
return
# attemptObj = Attempt()
# attempt.student = Student.objects.get(username=request.session['username'])
# attemptObj.test = responses[0].test_ID
# attemptObj.save()
evalObj.student_id = otherData['username']
evalObj.test_ID_id = int(otherData['testID'])
#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)
#put these in a dictionary {q_ID:[marks_pos, marks_neg]}
marksDict = {}
for c in contains:
marksDict[c.q_ID_id] = [c.marks_pos, c.marks_neg]
# evalObj.attempt = attemptObj
evalObj.q_ID = None
totalMarks = 0
correctQList = [] #list of correctly attempted questions
correctAnswer = None
for response in responses:
evalObj = Evaluation()
evalObj.student_id = otherData['username']
evalObj.test_ID_id = int(otherData['testID'])
evalObj.q_ID = None
(question, options), = response.items()
question = int(question)
# options = responses[question]
......@@ -49,24 +70,42 @@ def evaluate(responses, otherData):
# evalObj.marks = 1
responseList = options
# print "correctanswer"
# print correctAnswer
# print correctAnswer.values('pk')
# correctAnswer = list(correctAnswer.values('pk'))
# correctAnswer = list(map(lambda x: x['pk'], correctAnswer))
print correctAnswer
if len(responseList) == len(correctAnswer) and sorted(responseList) == sorted(correctAnswer):
evalObj.marks = 1
# print "responses"
# print responseList
# print correctAnswer
# print evalObj
evalObj.marks = marksDict[question][0] #0 - first in the list, marks_pos
totalMarks = totalMarks + evalObj.marks
correctQList.append(question) #add to list of correctly attempted questions
#else, it is a wrong answer since no attempt results in no response
else:
evalObj.marks = marksDict[question][1] #1 - second in the list, marks_neg
totalMarks = totalMarks + evalObj.marks
try:
evalObj.save()
except IntegrityError as e:
print "Integrity error - evaluation not recorded"
pass
#update questions' data
#https://docs.djangoproject.com/en/2.1/topics/db/queries/#updating-multiple-objects-at-once
models.Question.objects.filter(q_ID__in=QList).update(
num_appeared = F('num_appeared')+1)
models.Question.objects.filter(q_ID__in=correctQList).update(
num_correct = F('num_correct')+1)
#write takesObj
takesObj = Takes()
takesObj.student_id = otherData['username']
takesObj.test_ID_id = otherData['testID']
takesObj.time_stamp = datetime.datetime.now()
takesObj.total_marks = totalMarks
try:
takesObj.save()
except IntegrityError as e:
print "Integrity error in Takes - not recorded"
pass
def getOptions(question): #returns queryset
return models.Options.objects.get(q_ID = question)
......
......@@ -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:
......@@ -230,12 +260,19 @@ def loadStudentTest(request):
test_ID = request.POST['testID']
testName = Test.objects.values('test_name').get(pk=test_ID)
print testName
st = Test.objects.values('start_time').get(pk=test_ID)
start_time = st['start_time']
M = Test.objects.values('max_marks').get(pk=test_ID)
total_time = Test.objects.values('expected_time_for_completion').get(pk=test_ID)
end_time = start_time + total_time['expected_time_for_completion']
print end_time.time()
secs = (total_time['expected_time_for_completion'].seconds)
hours = secs // 3600
minute = (secs % 3600) // 60
questions = Contains.objects.filter(test_ID=test_ID).values('q_ID')
options = models.Options.objects.select_related('q_ID').filter(q_ID__in = questions)
print test_ID
print questions.all()
questionsJSON = {}
for option in options:
if option.q_ID.question_text in questionsJSON:
......@@ -246,10 +283,15 @@ def loadStudentTest(request):
option.pk, option.option_Value]]
# print option.option_Value
# print option.q_ID.q_ID
args['questions'] = questionsJSON
args['testName'] = testName
args['testID'] = test_ID
args['max_marks'] = M['max_marks']
args['end_time'] = end_time.strftime("%Y, %m,%d, %H,%M,%S")
minutes = ""
if minute != 0:
minutes = str(minute) + " mins"
args['total_time'] = {'hours' : str(hours) + " hr" , 'minutes' : minutes}
return render(request, 'ARFA_app/loadStudentTest.html', args)
def testHome(request):
......@@ -397,7 +439,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 vars(form)
if form.is_valid():
test = form.save()
......@@ -628,4 +670,11 @@ def result_analysis(request,test_ID):
def addimage(request):
files = request.FILES
print files
print "hello"
return HttpResponse("success")
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