Commit 82070acd authored by SANCHIT JAIN's avatar SANCHIT JAIN

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

parents 9e156cd8 9fb0d9c1
{
"python.linting.enabled": false
}
\ No newline at end of file
......@@ -45,7 +45,7 @@ class TestForm(forms.ModelForm):
# 'expected_time_for_completion': forms.TimeInput(attrs={'type':'time'}),
# 'start_time': forms.DateInput(attrs={'type':'datetime-local'}),
}
exclude = ['test_ID', 'ownership']
exclude = ['test_ID', 'ownership', 'max_marks']
# def clean_start_time(self):
# dt = self.cleaned_data['start_time']
# print dt
......
# -*- coding: utf-8 -*-
# Generated by Django 1.11.15 on 2018-11-26 18:47
# Generated by Django 1.11.16 on 2018-11-27 03:40
from __future__ import unicode_literals
import django.core.validators
......@@ -144,8 +144,6 @@ class Migration(migrations.Migration):
fields=[
('test_ID', models.AutoField(primary_key=True, serialize=False)),
('test_name', models.CharField(max_length=200, unique=True)),
('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()),
('max_marks', models.IntegerField(null=True)),
......
......@@ -28,11 +28,12 @@ class Faculty(arfa_user):
class Test(models.Model):
test_ID = models.AutoField(primary_key=True)
test_name = models.CharField(max_length=200,unique=True)
visibility_student = models.CharField(max_length=20)
ownership = models.CharField(max_length=20)
# 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,blank=False)
max_marks = models.IntegerField(null=True)
# class TestQuestions(models.Model):
# test_ID = models.ForeignKey(
......
*.jpg
*.png
*.jpeg
\ No newline at end of file
{%extends 'base2.html'%}
{%block head%}
<script>
total_marks = 0;
num_questions = 0;
function dispTotalMarks() {
$('#total_marks').html(total_marks);
}
function computeTotalMarks() {
val = 0;
$('.pos_marks').each(function() {
//add '#' to the id of checkbox to obtain that element
//'if' condition checks if the box is checked
//if it is, add to val
if(document.getElementById($(this).attr('checkBoxID')).checked) {
console.log($(this).attr('checkBoxID'))
val += parseFloat($(this).val());
}
})
total_marks = val;
}
function handleMarkChange() {
computeTotalMarks();
dispTotalMarks();
}
function handleCheckBoxClick(cb) {
posmarks = parseFloat((document.getElementById(
cb.getAttribute('posMarksID'))).value);
// get value of input field like so: element.value
if(cb.checked) {
total_marks += posmarks;
//update num_questions
num_questions++;
}
else {
total_marks -= posmarks
//update num_questions
num_questions--;
}
dispTotalMarks();
dispNumQuestions();
}
function dispNumQuestions() {
$('#num_questions').html(num_questions);
}
function getDiff()
{
var listItem = document.getElementsByClassName("bigclass");
var diffle = document.getElementById("di").value ;
for (var i=0; i < listItem.length; i++) {
listItem[i].style.display = "" ;
if (listItem[i].id != diffle && diffle != "")
listItem[i].style.display = "None" ;
}
}
</script>
{%endblock%}
{%block title%}
Create Test
......@@ -9,7 +71,7 @@ Create Test
{%block body%}
<h1> You CAN CREATE A Test HERE prof {{username}}</h1>
<h1 style="text-align:center"> Create a test here</h1>
<div class="container">
<div class="panel-default">
......@@ -17,22 +79,54 @@ Create Test
<h3 class="panel-title">Choose which questions are to be a part of the test</h3>
</div>
<ul class="list-group">
<!-- <ul> -->
<div>
<div style="float:right ; margin-right: 35px ">
Total Marks : <p id='total_marks' style="float:right;"></p>
</div>
<br/> <br/>
<div style="float:right ;margin-right: 35px ">
Number of Questions : <p id='num_questions' style="float:right;"></p>
</div>
<br/> <br/>
<div style="float:right ;margin-right: 30px ">
<input id="di" placeholder="Set difficulty" type="text" style="float:left;">
<button onclick="getDiff()" style="background-color:rgb(71, 118, 219); color: ">Filter </button>
</div>
</div>
</div>
<form method="POST" action="create_Test">
{% csrf_token %}
{{ TestForm.as_p }}
{{TestForm.errors}}
{{TestForm.non_field_errors}}
{%for question in questions%}
<li class="list-group-item">
<!-- <li> -->
<div class="row toggle">
<li class="list-group-item bigclass" id={{question.difficulty_set}}>
<div class="row toggle" style="margin-left:10%" >
<div class="col-xs-10">
<input type="checkbox" value= "True" name = "{{question.q_id}}" >
{{question.question_text}} {{question.q_id}} </br>
<input type="checkbox" value= "True" name = "{{question.q_id}}"
id = "{{question.q_id}}" onclick="handleCheckBoxClick(this)"
posMarksID="{{question.q_id}}pos_marks">
<!-- link to posmarks in checkbox -->
{{question.question_text}} </br>
<p style="float:right;"><b>Difficulty: </b> {{question.difficulty_set}}</p>
{%if question.ip%}
{%load static%}
<div align="center">
<img src = "{% static "" %}{{question.ip|slice:"16:" }}" width="35%" height="35%">
<p style="margin-top:5px">
{{question.imdesc}}
</p>
</div>
{%endif%}
</div>
</div>
<div>
<div style="margin-left:10%">
<hr></hr>
<ul>
{%for option in question.option_details%}
......@@ -46,19 +140,29 @@ Create Test
</li>
{%endif%}
{%endfor%}
<label> marks
<input type="number" name="{{question.q_id}}" min="0" max="10" placeholder="4" step="0.25" value="4">
<input type="number" name="{{question.q_id}}" min="-10" max="0" placeholder="-1" step="0.25" value="0">
</label>
<label style="margin-top:10px; margin-right:5px"> marks </label>
<!-- the id of checkboxes is q_id. I'm linking pos_marks to checkboxes
by id -->
<input class = "pos_marks" type="number" name="{{question.q_id}}"
min="0" max="10" placeholder="4" step="0.25" value="4"
checkBoxID = "{{question.q_id}}" onchange="handleMarkChange()"
id="{{question.q_id}}pos_marks">
<input type="number" name="{{question.q_id}}"
min="-10" max="0" placeholder="-1" step="0.25" value="0">
</ul>
</div>
</li>
{%endfor%}
<div style="float:right; margin-top: 10px; margin-right:20px " >
<button type="submit" class="btn btn-login float-right">Submit</button>
</div>
</form>
</ul>
</div>
<br><br><br><br><br><br>
</div>
{%endblock%}
\ No newline at end of file
......@@ -75,7 +75,7 @@ function prevTab(elem) {
var check = document.createElement("input");
var check_ans = document.createElement("label");
check_ans.for = "c" + x ;
check_ans.innerHTML = "Is this an / the answer?"
check_ans.innerHTML = "Is this an / the answer?" ;
check.type="checkbox";
check.className = "form-control" ;
check.name="c" + x ;
......@@ -110,8 +110,9 @@ function prevTab(elem) {
var qtext = document.getElementById('qtext').value ;
question_data['subject_ID'] = subject.value ;
question_data['question_text'] = qtext ;
console.log(question_data['question_text']) ;
console.log(question_data['subject_ID']) ;
question_data['difficulty_set'] = document.getElementById('diff').value;
question_data['visibility'] = document.getElementById('visible').value ;
console.log(question_data) ;
document.getElementById('l2').click() ;
}
......@@ -228,7 +229,7 @@ Create Question
{%endblock%}
{%block body%}
<h3> You CAN CREATE A QUESTION HERE prof {{username}}</h3>
<h3 style="text-align:center"> Create a question here</h3>
<div class="container" title="this is title">
<div class="row">
<section>
......@@ -288,6 +289,18 @@ Create Question
<label>Question Text</label>
<textarea class="form-control" rows="6" id= "qtext"></textarea>
</div>
<div class="form-group col-lg-4">
<label style="margin-right:20px">Specify question difficulty</label>
<input type="number" name="quantity" min="1" max="10" placeholder="5" value="5" id="diff">
</div>
<br>
<div class="form-group col-lg-4">
<label style="margin-right:20px;">Specify question visibility</label>
<select name="visible" id="visible">
<option value="public" >Public</option>
<option value="private" >Private</option>
</select>
</div>
</div>
<div class="tab-pane" role="tabpanel" id="step2">
<h3>Step 2 - Add some options</h3>
......@@ -308,7 +321,7 @@ Create Question
<p> Drop images in the order you want to display</p>
<ul class="list-inline pull-right">
<li><button type="button" class="btn btn-default prev-step" onclick="document.getElementById('l2').click() ; ">Previous</button></li>
<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-default next-step" onclick="document.getElementById('l4').click() ;">Skip</button></li> -->
<li><button align="left" type="button" class="btn btn-primary" id="addsubjectiveque" onclick="intend_to_add_img() ; post()" >Add an image</button></li>
<li><button type="button" class="btn btn-primary btn-info-full next-step" onclick="post()">Post Question</button></li>
</ul>
......
......@@ -143,12 +143,12 @@ profile
</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-eye-slash"></i></span>VIEW MY Test
<span class="btn-label"><i class="fa fa-eye-slash"></i></span>VIEW MY Tests
</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-eye"></i></span>VIEW ALL Test
<span class="btn-label"><i class="fa fa-eye"></i></span>VIEW ALL Tests
</button></center>
</a>
......
......@@ -13,15 +13,19 @@ 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>
<h2 align="center" style=" text-decoration: underline;"><b> {{testName.test_name}} </b> </h2>
</div>
<script>
function submitExam()
{
document.getElementById('ExamForm').submit() ;
}
</script>
<script>
// Set the date we're counting down to
var countDownDate = new Date( {{ end_time }} );
countDownDate.setMonth(countDownDate.getMonth() - 1) ;
countDownDate.setMonth(countDownDate.getMonth() - 1) ;
countDownDate.setMonth(countDownDate.getMonth() - 1) ;
console.log(countDownDate) ;
// Update the count down every 1 second
var x = setInterval(function() {
......@@ -51,19 +55,37 @@ var x = setInterval(function() {
<div style="margin-left: 5%; margin-top: 10%">
<ol>
<font size="3">
<form class="exam-form" method="POST" action="/arfa/result">
<form class="exam-form" method="POST" action="/arfa/result" id="ExamForm">
<p style="margin-right: 5%"> <b> Questions </b></p>
{% csrf_token %}
<input name="testID" value="{{testID}}" type="hidden" >
{% for question, options in questions.items %}
{{images}}
{% for question, data in questions.items %}
<div class="row" style="margin-top: 10px; margin-bottom: 10px">
<li style="font-weight: bold;" > {{ question }}</li>
{% for option in options %}
<li style="font-weight: bold;margin-left: 10px; margin-bottom: 10px" > {{ question }}<br></li>
<!-- adding an image -->
{% for image in data.images %}
{%load static%}
{%if image.0 %}
<div align="center" style="margin-top:30px">
<img src = "{% static "" %}{{ image.0 }}" width="35%" height="35%" >
<p style="margin-top:5px">{{image.1}}</p>
{%endif%}
</div>
{% endfor %}
{% for option in data.options %}
<input type="checkbox" name = "{{option.0}}" value= "{{option.1}}" > {{ option.2 }} </br>
{% endfor %}
</div>
{% endfor %}
<button type="submit" class="btn btn-login" style="float: right;">Submit</button>
<button onclick="submitExam()" class="btn btn-login" style="float: right;">Submit</button>
</form>
</font>
......
......@@ -12,7 +12,7 @@ Logout
{%endblock%}
{%block body%}
<h3 class="myh3 deepshd"> You have succesfully logged out </h3>
<h3 style="text-align:center" class="myh3 deepshd"> You have succesfully logged out </h3>
<!-- <div class="container">
<centre>
<h1> You have succesfully logged out</h1>
......
......@@ -7,5 +7,5 @@ View All Question
{%endblock%}
{%block body%}
<h1> You are not authorized for this action {{username}}</h1>
<h1 style="text-align:center"> You are not authorized for this action {{username}}</h1>
{%endblock%}
\ No newline at end of file
{%extends 'base2.html'%}
{%block title%}
View personal Question
{%endblock%}
{%block head%}
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1.0', {'packages':['corechart']});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
// data.addColumn('string', 'Number');
data.addColumn('string', 'bin');
data.addColumn('number', 'Count');
// data.addRows( [['100',10],['90',9],['80',8]] );
data.addRows( {{distribution|safe}} );
console.log(data)
var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
chart.draw(data, {width: 500, height: 300, title: "Scores Distribution"});
}
</script>
{%endblock%}
{%block body%}
<h1 style="text-align:center"> Test Performance</h1>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css">
<div class="container">
<div class="panel-default">
<div class="panel-heading">
<h3 class="panel-title"> Test Stats </h3>
</div>
<ul class="list-group">
<li class="list-group-item">
<div class="row toggle">
<div id="c1" class="col-xs-10" style="float:left;width:50%">
<p> Average Score : {{test_aggregates.avg_marks}}</p>
<p>Best Score : {{test_aggregates.max_marks}} </p>
<p>Minimum score : {{test_aggregates.max_marks}} </p>
<p>Students appeared : {{test_aggregates.students_appeared}}</p>
</div>
<div class="col-xs-10" style="float: right;width:50%" id="chart_div"> </div>
</div>
<!-- <div>
<hr></hr>
</div> -->
</li>
</ul>
<!-- <div id="chart_div" > </div> -->
<div class="panel-heading">
<h3 class="panel-title"> Student Performance </h3>
</div>
<ul class="list-group">
{%for p in student_performance%}
<li class="list-group-item">
<!-- <li> -->
<div class="row toggle">
<div class="col-xs-10">
<p> student: {{p.student_id}}</p>
<p> rank: {{p.rank}}</p>
<p> Score: {{p.marks}}</p>
</div>
</div>
<!-- <div class="container"> -->
<!-- <div class="fluid-row"> -->
<!-- <ul>
{%for option in question.option_details%}
{%if option.is_answer %}
<li>
<p style="color: green"> {{option.option_text}} </p>
</li>
{%else%}
<li>
{{option.option_text}}
</li>
{%endif%}
{%endfor%}
</ul> -->
<!-- </div> -->
<!-- </div> -->
</li>
{%endfor%}
</ul>
<div class="panel-heading">
<h3 class="panel-title"> Per Question stats </h3>
</div>
<ul class="list-group">
{%for q in question_stats%}
<li class="list-group-item">
<!-- <li> -->
<div class="row toggle">
<div class="col-xs-10">
<p> Difficulty set: {{q.difficulty_set}}</p>
<p> Difficulty observed: {{q.difficulty_observed}}</p>
<p> Question: {{q.question_text}} </p>
</div>
</div>
<div>
<div>
<hr></hr>
<!-- <div class="container"> -->
<!-- <div class="fluid-row"> -->
<ul>
{%for option in q.option_details%}
{%if option.is_answer %}
<li>
<p style="color: green"> {{option.option_text}} </p>
</li>
{%else%}
<li>
{{option.option_text}}
</li>
{%endif%}
{%endfor%}
</ul>
<!-- </div> -->
<!-- </div> -->
</div>
</div>
</li>
{%endfor%}
</ul>
</div>
</div>
{%endblock%}
......@@ -5,6 +5,8 @@ profile
{%block body%}
<h1 style="text-align:center">Test Successfully Recorded </h1>
{%endblock%}
\ No newline at end of file
......@@ -16,17 +16,26 @@ My Tests
</div>
<ul class="list-group">
{% for t in activeTests %}
<div>
<p>{{t.test_ID}}</p>
<p>{{t.test_name}}</p>
</div>
<div class="row" style="margin-bottom: 10px; margin-top: 5px">
<div style="float: left; margin-left: 20px">
<p><i>Test Id</i> <b> {{t.test_ID}}</b></p>
<p><i> Test Name</i> <b>{{t.test_name}}</b> </p>
</div>
<div style="float:right">
<form method="POST" action="loadStudentTest">
{% csrf_token %}
<input name="testID" value="{{t.test_ID}}" type="hidden">
<button type="submit" class="btn btn-login float-right" style="margin-top: 10px ;margin-right: 40px">Load Test</button>
{% if t.hasTaken is True %}
<button type="button" disabled class="btn btn-login float-right"
style="margin-top: 10px ;margin-right: 40px">Attempted</button>
{% else %}
<button type="submit" class="btn btn-login float-right"
style="margin-top: 10px ;margin-right: 40px">Load Test</button>
{% endif %}
</form>
</div>
</div>
{% endfor %}
</ul>
</div>
......@@ -47,11 +56,34 @@ My Tests
<p><i> Test Name</i> <b>{{t.test_name}}</b> </p>
</div>
<div style="float:right">
<form method="POST" action="loadStudentTest">
<div class="row">
<form method="POST" action="loadStudentTest" style="float:right;">
{% csrf_token %}
<input name="testID" value="{{t.test_ID}}" type="hidden">
<button type="submit" class="btn btn-login float-right" style="margin-top: 10px ;margin-right: 40px">Load Test</button>
<button type="submit" class="btn btn-login float-right"
style="margin-top: 10px ;margin-right: 40px">Load Test</button>
</form>
<form method="POST" action="viewStudentPerformance" style="float:left;">
{% csrf_token %}
<!-- {% if t.hasTaken is True %} -->
<input name="test_ID" value="{{t.test_ID}}" type="hidden">
<button type="submit" class="btn btn-login float-right"
style="margin-top: 10px ;margin-right: 40px; background-color: gray; ">View Results</button>
<!-- {% endif %} -->
</form>
<form method="POST" action="CompareResponses" style="float:left;">
{% csrf_token %}
{% if t.hasTaken is True %}
<input name="test_ID" value="{{t.test_ID}}" type="hidden">
<button type="submit" class="btn btn-login float-right"
style="margin-top: 10px ;margin-right: 40px; background-color: gray; ">View Responses</button>
{% endif %}
</form>
</div>
</div>
</div>
{% endfor %}
......
{%extends 'base2.html'%}
{%block title%}
View personal Question
{%endblock%}
{%block head%}
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1.0', {'packages':['corechart']});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
// data.addColumn('string', 'Number');
data.addColumn('string', 'bin');
data.addColumn('number', 'Count');
// data.addRows( [['100',10],['90',9],['80',8]] );
data.addRows( {{distribution|safe}} );
console.log(data)
var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
chart.draw(data, {width: 500, height: 300, title: "Scores Distribution"});
}
</script>
{%endblock%}
{%block body%}
<h1 style="text-align:center"> Test Performance</h1>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css">
<div class="container">
<div class="panel-default">
<div class="panel-heading">
<h3 class="panel-title"> Test Stats </h3>
</div>
<ul class="list-group">
<li class="list-group-item">
<div class="row toggle">
<div id="c1" class="col-xs-10" style="float:left;width:50%">
<p> Average Score : {{test_aggregates.avg_marks}}</p>
<p>Best Score : {{test_aggregates.max_marks}} </p>
<p>Minimum score : {{test_aggregates.min_marks}} </p>
<p>Students appeared : {{test_aggregates.students_appeared}}</p>
</div>
<div class="col-xs-10" style="float: right;width:50%" id="chart_div"> </div>
</div>
<!-- <div>
<hr></hr>
</div> -->
</li>
</ul>
<div class="panel-heading">
<h3 class="panel-title"> Your Standings </h3>
</div>
<ul class="list-group">
<li class="list-group-item">
<div class="row toggle">
<div id="c1" class="col-xs-10" style="float:left;width:50%">
<p> rank : {{rank}}</p>
<p> Score : {{marks}}</p>
</div>
<div class="col-xs-10" style="float: right;width:50%" id="chart_div"> </div>
</div>
<!-- <div>
<hr></hr>
</div> -->
</li>
</ul>
<!-- <div id="chart_div" > </div> -->
<div class="panel-heading">
<h3 class="panel-title"> Students Performance </h3>
</div>
<ul class="list-group">
{%for p in student_performance%}
<li class="list-group-item">
<!-- <li> -->
<div class="row toggle">
<div class="col-xs-10">
<p> student: {{p.student_id}}</p>
<p> rank: {{p.rank}}</p>
<p> Score: {{p.marks}}</p>
</div>
</div>
<!-- <div class="container"> -->
<!-- <div class="fluid-row"> -->
<!-- <ul>
{%for option in question.option_details%}
{%if option.is_answer %}
<li>
<p style="color: green"> {{option.option_text}} </p>