Commit ac01b153 authored by Samarth Joshi's avatar Samarth Joshi

Adding monitor functionaly (partial)

parent bddcca5e
......@@ -33,17 +33,14 @@ urlpatterns = [
path('save_ans/',a.save_ans,name="saveans"),
path('save_cribs/',a.save_cribs,name="savecribs"),
path('result/',a.result,name="result"),
url(r'^upload/',TemplateView.as_view(template_name = 'upload.html')),
url('instructor/',a.instructor),
url('quizTable/',a.quizTable),
path('uploaded/',a.upload_file,name="uploaded"), path('sign_up/',a.sign_up,name="sign-up"), path('accounts/',include('django.contrib.auth.urls')),
path('create_quiz/',a.create_quiz),
path('add_quiz/',a.add_quiz),
path('monitor/',a.monitor),
path('heartbeat/',a.heartbeat),
path('getbeat/',a.getbeat),
path('logout/', auth_views.LogoutView.as_view(), name='logout')
]+ static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
No preview for this file type
# Generated by Django 3.1.2 on 2020-11-13 09:34
import datetime
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Questions',
fields=[
('question', models.TextField()),
('option1', models.CharField(max_length=100)),
('option2', models.CharField(max_length=100)),
('option3', models.CharField(max_length=100)),
('option4', models.CharField(max_length=100)),
('answer', models.CharField(max_length=100)),
('type', models.CharField(default=1, max_length=10)),
('marks', models.IntegerField(default=1)),
('negative', models.FloatField(default=0, max_length=10)),
('explainations', models.TextField(default='No Explaination Given', max_length=1000)),
('questionId', models.AutoField(primary_key=True, serialize=False)),
('quizCode', models.CharField(default='Code', max_length=100)),
],
options={
'db_table': 'Questions',
},
),
migrations.CreateModel(
name='quiz',
fields=[
('quizId', models.AutoField(primary_key=True, serialize=False)),
('startTime', models.TimeField()),
('date', models.DateField(default=datetime.date.today)),
('length', models.FloatField(max_length=10)),
('quizCode', models.CharField(default='Code', max_length=100)),
('quizDone', models.BooleanField(default=False)),
('quizInfo', models.CharField(default='No Info Available', max_length=100)),
('quizInstructor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='submission',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('option', models.CharField(max_length=100)),
('questionId', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='quiz.questions')),
('quizId', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='quiz.quiz')),
('studentId', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='result',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('marks', models.IntegerField(default=0, max_length=10)),
('quizId', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='quiz.quiz')),
('studentId', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.AddField(
model_name='questions',
name='quizId',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='quiz.quiz'),
),
migrations.CreateModel(
name='Permission',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('role', models.CharField(default='S', max_length=1)),
('userId', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
migrations.CreateModel(
name='cribs',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('cribs', models.CharField(max_length=1000)),
('questionId', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='quiz.questions')),
('quizId', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='quiz.quiz')),
('studentId', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
options={
'db_table': 'cribs',
},
),
]
# Generated by Django 3.1.2 on 2020-11-13 10:47
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('quiz', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='cribs',
name='studentId',
field=models.CharField(max_length=100),
),
]
# Generated by Django 3.1.2 on 2020-11-13 10:48
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('quiz', '0002_auto_20201113_1047'),
]
operations = [
migrations.AlterField(
model_name='cribs',
name='studentId',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
),
]
#quiz_create_form {
.quiz_create_form {
max-width: 800px;
margin: 40px auto;
animation: grow 0.3s 1;
position: relative;
animation-timing-function: cubic-bezier(0.42,0,0.58,1);
}
@keyframes grow {
0% {
opacity: 0;
top: 50px;
}
100% {
opacity: 1;
top:0px;
}
}
.navbar {
max-width: 800px;
margin: auto;
margin: 10px auto;
}
#quiz_controls {
border: solid 1px #EEE;
......@@ -22,7 +39,13 @@
color: white;
}
#quiz_controls a {
display: block;
color: white;
cursor: pointer;
}
#quiz_controls a:hover {
color: rgb(224, 227, 255);
cursor: pointer;
}
a.three:link {color: #ffffff;}
a.three:visited {color: #ffffff;}
......
......@@ -99,5 +99,5 @@ function submit_form() {
}
}
document.getElementById("quiz_create_form").submit();
document.getElementById("manual_form").submit();
}
\ No newline at end of file
......@@ -18,7 +18,7 @@
document.onkeydown = function (e) {
return false;
}
document.addEventListener('contextmenu', event => event.preventDefault());
//document.addEventListener('contextmenu', event => event.preventDefault());
</script>
</head>
<body>
......@@ -130,8 +130,6 @@
var fsscreen = document.getElementById("forcefs");
var initscr = document.getElementById("initial_screen");
var checkfs = setInterval(function() {
if(document.fullscreenElement || document.webkitFullscreenElement ||
document.mozFullScreenElement) {
fsscreen.style.display = "none";
......@@ -140,6 +138,26 @@
fsscreen.style.display = "block";
}
}, 1000);
function get_fs() {
if(document.fullscreenElement || document.webkitFullscreenElement || document.mozFullScreenElement) {
return true;
} else {
return false;
}
}
var heartbeat = setInterval(function() {
var quizId = {{quizId}};
$.get("/heartbeat/",
{
question: current_question,
quiz: quizId,
fullscreen: get_fs()
},
function(data, status){
console.log("Heartbeat sent!");
});
}, 1000);
</script>
</body>
</html>
......@@ -154,6 +154,13 @@
max-height: 500px;
overflow-y: scroll;
}
.header {
background-color: white;
cursor: pointer;
}
.crib_table tr:hover {
background-color: #e6e6e6;
}
.crib_table th {
border-left: solid 1px #e6e6e6;
border-right: none;
......@@ -167,12 +174,20 @@
border-left: solid 1px #e6e6e6;
border-right: none;
border-top: none;
border-bottom: none;
border-bottom: solid 1px #e6e6e6;
padding: 15px;
}
#question_palette > h2 {
text-align: center;
}
.question_view {
text-align: left;
margin: 20px;
}
.collapsed {
display: none;
background-color: #e6e6e6 ;
}
</style>
</head>
<body>
......@@ -217,10 +232,23 @@
<thead><th>Question</th><th>StudentId</th><th>Cribs</th></thead>
<tbody>
{%for crib in cribs%}
<tr>
<td>{{crib.0}}</td>
<td>{{crib.1}}</td>
<td>{{crib.2}}</td>
<tr class="header">
<td width="10%">{{crib.questionId}}</td>
<td>{{crib.cribs}}</td>
<td>{{crib.studentId}}</td>
</tr>
<tr id="question_of_crib_{{forloop.counter0}}" class="collapsed">
<td colspan="3">
<div class="question_view">
{{crib.questionId.question}}
<ul>
<li>A. {{crib.questionId.option1}}</li>
<li>B. {{crib.questionId.option2}}</li>
<li>C. {{crib.questionId.option3}}</li>
<li>D. {{crib.questionId.option4}}</li>
</ul>
</div>
</td>
</tr>
{%endfor%}
</tbody>
......@@ -229,5 +257,12 @@
</div>
</div>
</div>
<script>
$('tr.header').click(function(){
$(this).nextUntil('tr.header').css('display', function(i,v){
return this.style.display === 'table-row' ? 'none' : 'table-row';
});
});
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
{% load static %}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:ital,wght@0,300;0,400;0,700;1,400&display=swap" rel="stylesheet">
<style>
.quizlist {
max-width: 800px;
margin: auto;
}
iframe {
width: 100%;
border: solid 2px #ccc500;
border-radius: 6px;
}
.control_group {
display: flex;
justify-content: space-between;
}
.control_group > button {
height: 50px;
align-self: center;
}
</style>
</head>
<body>
<section class="quizlist">
<div class="control_group">
<div class="quiz_details">
<h1>{{ quiz.quizInfo }}</h1>
<h3>{{ quiz.quizCode }}</h3>
</div>
<button type="button">Start Monitoring</button>
</div>
<tr><td colspan=2><iframe src="/getbeat/?quiz={{ quiz.quizId }}"></iframe></td></tr>
</tbody>
</section>
<script>
</script>
</body>
</html>
\ No newline at end of file
......@@ -57,6 +57,7 @@
margin-bottom: 0px;
}
.profile h1 {
z-index: 10000;
margin-top: 0px;
margin-bottom: 0px;
font-size: 2.5em;
......@@ -114,15 +115,44 @@
}
.menu_card_wrapper {
margin: 50px;
width: 300px;
width: 280px;
flex-direction: column;
}
.menu_card {
text-decoration: none;
width: 300px;
margin: 10px;
width: 280px;
height: 400px;
margin: 10px;
box-shadow: 1px 1px 5px rgb(158, 158, 158);
animation: grow 1s 1;
position: relative;
}
.menu_card * {
animation: fadein 1s 1;
}
@keyframes fadein {
0% {
opacity: 0;
}
50% {
opacity: 0;
}
100% {
opacity: 1;
}
}
@keyframes grow {
0% {
top: -300px;
width: 0px;
height: 0px;
}
100% {
top: 0px;
width: 280px;
height: 400px;
}
}
.menu_card:hover {
box-shadow: 1px 1px 5px rgb(87, 87, 87);
......@@ -146,6 +176,15 @@
top:0px;
left:0px;
z-index: -100;
animation: appear 0.5s 1;
}
@keyframes appear {
0% {
height: 0px;
}
100% {
height: 350px;
}
}
}
</style>
......@@ -160,7 +199,7 @@
<br><h1><a href="/instructor?quiz_id={{quiz.0}}">Instructor Graphs for quizCode:{{quiz.1}}</a></h1></center>
{%endfor%} -->
<canvas class="backdrop"></canvas>
<div class="backdrop"></div>
<section class="cards">
<a class="menu_card" id="menucard_createquiz" href="/create_quiz/">
<div class="menu_card_wrapper">
......
......@@ -7,12 +7,66 @@
<link href="{% static 'css/quiz_attempt_page.css' %}" rel="stylesheet">
<link href="{% static 'css/quiz_create_page.css' %}" rel="stylesheet">
<script src="{% static 'js/quiz_create_page.js' %}"></script>
<style>
.flow {
border: solid 2px #3F51B5;
background-color: white;
border-radius: 1em;
margin-bottom: 200px;
box-shadow: #999999 3px 5px 6px;
}
.step {
margin: 40px;
}
.aut_btn {
padding: 15px;
font-size: 1em;
font-weight: bold;
width: 200px;
background-color: white;
border: solid 2px #3F51B5;
cursor: pointer;
border-radius: 6px;
color: #3F51B5;
transition: background-color 0.2s ease, color 0.2s ease;
}
.aut_btn > a {
display: block;
}
.custom-file-upload {
display: block;
text-align: center;
padding: 15px;
font-size: 1em;
font-weight: bold;
width: 166px;
cursor: pointer;
background-color: white;
border: solid 2px #3F51B5;
border-radius: 6px;
color: #3F51B5;
transition: background-color 0.2s ease, color 0.2s ease;
}
.aut_btn:hover, .custom-file-upload:hover {
background-color: #3F51B5;
border: solid 2px #3F51B5;
color: white
}
input[type="file"] {
display: none;
}
#automatic_form {
display: none;
}
</style>
</head>
<body onload="add_que()">
<section>
<form action="/add_quiz/" id="quiz_create_form" enctype = "multipart/form-data" method = "POST">{% csrf_token %}
<form action="/add_quiz/" class="quiz_create_form" id="manual_form" enctype = "multipart/form-data" method = "POST">{% csrf_token %}
<div id="quiz_controls">
<p><a href="../upload">Click here to automatically add all questions by uploading csv</a></p>
<p><a onclick="show_auto()">Click here to automatically add all questions by uploading csv</a></p>
<div style="padding: 20px">
<h3>Quiz Name:</h3>
<input type="text" id="quiz_name" name="quiz_name"><br/>
......@@ -34,9 +88,79 @@
</div>
<div id="qbunch">
</div>
<button type="button" id="add_question" onclick="add_que()">+ Add Question</button>
<button type="button" id="create_submit" onclick="submit_form()">Submit</button>
<button type="button" class="man_btn" id="add_question" onclick="add_que()">+ Add Question</button>
<button type="button" class="man_btn" id="create_submit" onclick="submit_form()">Submit</button>
</form>
<form name = "form" enctype = "multipart/form-data"
action = "{% url "uploaded" %}" method = "POST" id="automatic_form" class="quiz_create_form">{% csrf_token %}
<div id="quiz_controls">
<p><a onclick="show_manual()">Click here to manually add all questions</a></p>
<div style="padding: 20px">
<h3>Quiz Name:</h3>
<input type="text" id="quiz_name" name="quiz_name"><br/>
</div>
<div class="quiz_timing_controls">
<div>
<label for="date"><h3>Quiz Date</h3></label>
<input type="date" id="date" name="date">
</div>
<div>
<label for="startTime"><h3>Start Time</h3></label>
<input type="time" id="startTime" name="startTime">
</div>
<div>
<label for="length"><h3>length (in minutes)</h3></label>
<input type="number" id="length" name="length">
</div>
</div>
</div>
<div class="flow">
<section class="step">
<h1>Step 1: Download Quiz Template</h1>
<a href="{% static 'assets/upload_template.csv' %}" download="upload_template.csv"><button class="aut_btn" type="button">Download CSV</button></a>
</section>
<hr/>
<section class="step">
<h1>Step 2: Open downloaded csv file and add questions in each row</h1>
<p>Format is as follows: (also specified inside the csv file)</p>
<p>Question | OptionA | OptionB | OptionC | OptionD | CorrectOption | QuestionType | Marks | NegativeMarks | Explanation</p>
</section>
<hr/>
<section class="step">
<h1>Step 3: Upload the modified document</h1>
<label class="custom-file-upload"><input type="file" placeholder="file" name="file" id= />Upload</label>
</section>
<hr/>
<section class="step">
<h1>Step 4: After uploading the document click on Submit to create the quiz.</h1>
<button class="aut_btn" type = "submit">
<strong>Submit</strong>
</button>
</section>
</div>
</form>
</section>
<script>
function show_manual() {
var man = document.getElementById("manual_form");
var aut = document.getElementById("automatic_form");
aut.style.display = "none";
man.style.display = "block";
}
function show_auto() {
var man = document.getElementById("manual_form");
var aut = document.getElementById("automatic_form");
aut.style.display = "block";
man.style.display = "none";
}
</script>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="1">
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:ital,wght@0,300;0,400;0,700;1,400&display=swap" rel="stylesheet">
<style>
* {
font-family: 'Source Sans Pro', sans-serif;
}
body {
margin: 0px;
border: none;
}
table {
width: 100%;
text-align: center;
}
table th {
padding: 10px;
}
table thead {
background-color: #ccc500;
color: white;
}
table td {
padding: 10px;
border-bottom: solid 1px grey;
}
</style>
</head>
<body>
<table cellspacing="0">
<thead><th>Student</th><th>Curent Question</th><th>Is Fullscreen</th><th>Last Seen</th></thead>
<tbody>
{%for user, value in activity.items%}
<tr>
<td>{{ user }}</td>
<td>{{ value.0 }}</td>
<td>{{ value.1 }}</td>
<td>
<span id="seen_{{forloop.counter0}}"></span>
<script>
"use strict";
var datet = new Date({{ value.2|safe }});
var timet = datet.getTime();
var now = new Date().getTime();
var distance = now - timet;
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);
var x = document.getElementById("seen_{{forloop.counter0}}");
x.innerHTML = hours + "h "+ minutes + "m " + seconds + "s ago";
</script>
</td>
</tr>
{%endfor%}
</tbody>
</table>
</body>
</html>
\ No newline at end of file
<html>
<head>
{% load static %}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:ital,wght@0,300;0,400;0,700;1,400&display=swap" rel="stylesheet">
<link href="{% static 'css/quiz_attempt_page.css' %}" rel="stylesheet">
<link href="{% static 'css/quiz_create_page.css' %}" rel="stylesheet">
<script src="{% static 'js/quiz_create_page.js' %}"></script>
<style>
.flow {
border: solid 2px #3F51B5;
background-color: white;
border-radius: 1em;
margin-bottom: 200px;
box-shadow: #999999 3px 5px 6px;
}
.step {
margin: 40px;
}
button {
padding: 15px;
font-size: 1em;
font-weight: bold;
width: 200px;
background-color: white;
border: solid 2px #3F51B5;
cursor: pointer;
border-radius: 6px;
color: #3F51B5;
transition: background-color 0.2s ease, color 0.2s ease;
}
button > a {
display: block;
}
.custom-file-upload {
display: block;
text-align: center;
padding: 15px;
font-size: 1em;
font-weight: bold;
width: 166px;
cursor: pointer;
background-color: white;
border: solid 2px #3F51B5;
border-radius: 6px;
color: #3F51B5;
transition: background-color 0.2s ease, color 0.2s ease;
}
button:hover, .custom-file-upload:hover {
background-color: #3F51B5;
border: solid 2px #3F51B5;
color: white
}
input[type="file"] {
display: none;
}
</style>
</head>
<body>
<form name = "form" enctype = "multipart/form-data"
action = "{% url "uploaded" %}" method = "POST" id="quiz_create_form">{% csrf_token %}
<div id="quiz_controls">
<p><a href="../create_quiz">Click here to manually add all questions</a></p>
<div style="padding: 20px">
<h3>Quiz Name:</h3>
<input type="text" id="quiz_name" name="quiz_name"><br/>
</div>
<div class="quiz_timing_controls">
<div>
<label for="date"><h3>Quiz Date</h3></label>
<input type="date" id="date" name="date">
</div>
<div>
<label for="startTime"><h3>Start Time</h3></label>
<input type="time" id="startTime" name="startTime">
</div>
<div>
<label for="length"><h3>length (in minutes)</h3></label>
<input type="number" id="length" name="length">
</div>
</div>
</div>
<div class="flow">
<section class="step">
<h1>Step 1: Download Quiz Template</h1>
<a href="{% static 'assets/upload_template.csv' %}" download="upload_template.csv"><button type="button">Download CSV</button></a>
</section>
<hr/>
<section class="step">
<h1>Step 2: Open downloaded csv file and add questions in each row</h1>
<p>Format is as follows: (also specified inside the csv file)</p>
<p>Question | OptionA | OptionB | OptionC | OptionD | CorrectOption | QuestionType | Marks | NegativeMarks | Explanation</p>
</section>
<hr/>
<section class="step">
<h1>Step 3: Upload the modified document</h1>
<label class="custom-file-upload"><input type="file" placeholder="file" name="file" id= />Upload</label>
</section>
<hr/>
<section class="step">
<h1>Step 4: After uploading the document click on Submit to create the quiz.</h1>
<button type = "submit">
<strong>Submit</strong>
</button>
</section>
</div>
</body>
</html>
\ No newline at end of file
......@@ -33,13 +33,11 @@ import json
import random
import string
from datetime import datetime
lst = []
from django.views.decorators.clickjacking import xframe_options_exempt
answers = []
anslist = []
marksList=[]
negative=[]
startedquiz = dict()
startedquiz[6] = dict()
def index(request):
quiz_id = int(request.GET['q'])
......@@ -49,7 +47,7 @@ def index(request):
endtime = json.dumps(endtime.isoformat())
count = len(obj)
print(obj)
return render(request,'index.html',{'questions':obj,'count':count, 'endtime': endtime})
return render(request,'index.html',{'questions':obj,'count':count, 'endtime': endtime, 'quizId': quiz_id})
@login_required
def result(request):
......@@ -86,7 +84,6 @@ def save_ans(request):
studentId=1# initialize here student id
t=submission(questionId=questionId,option=ans,quizId=quizId,studentId=studentId)
t.save()
lst.append(ans)
return HttpResponse('')
def save_cribs(request):
......@@ -159,12 +156,8 @@ def instructor(request):
quizInstance = quiz.objects.all().filter(quizId=quizId, quizInstructor=request.user)[0]
students = results.objects.all().filter(quizId=quizId).values('studentId')
marks = results.objects.all().filter(quizId=quizId).values('marks')
cribs=crib.objects.raw('select 1 as id, c.cribs,c.studentId,q.question from cribs c ,Questions q where c.quizId_id=q.quizId_id and c.quizId_id='+str(quizId))
cribbs= list()
for cribb in cribs:
result=(cribb.question,cribb.studentId,cribb.cribs)
if result not in cribbs:
cribbs.append(result)
cribs=crib.objects.all().filter(quizId=quizId).select_related()
fig, ax = plt.subplots()
allMarks=list()
for mark in marks:
......@@ -199,7 +192,7 @@ def instructor(request):
quizDone = False
if quizInstance.end_datetime < datetime.now():
quizDone = True
return render(request, 'instructor.html',{"graph": html_graph, "graph1": html_graph, "graph2": html_graph1,'quiz':quizInstance,'cribs':cribbs, 'all_quizes': allquizs, 'quizDone':quizDone})
return render(request, 'instructor.html',{"graph": html_graph, "graph1": html_graph, "graph2": html_graph1,'quiz':quizInstance,'cribs':cribs, 'all_quizes': allquizs, 'quizDone':quizDone})
def quizTable(request):
quizs = quiz.objects.filter(quizInstructor=request.user).all()
......@@ -292,5 +285,30 @@ def add_quiz(request):
return HttpResponse('sucess')#(request,'success')
def monitor(request):
q_id = request.GET.get('quiz')
allquizs = quiz.objects.all().filter(quizInstructor=request.user).order_by('-date', '-startTime')
return render(request, 'monitor.html', { 'quizs': allquizs })
if q_id:
quizId = int(q_id)
quizInstance = quiz.objects.get(pk=quizId)
return render(request, 'monitor.html', { 'quiz': quizInstance })
else:
return render(request, 'monitor.html', { 'quiz': allquizs[0] })
@xframe_options_exempt
def getbeat(request):
quizId = int(request.GET.get('quiz'))
test = startedquiz.get(quizId)
print(test)
return render(request,'student_activity.html', {'activity': test })
def heartbeat(request):
quizId = int(request.GET.get('quiz'))
if quizId in startedquiz:
question = int(request.GET.get('question'))
fs = request.GET.get('fullscreen')
time = datetime.now()
jtime = json.dumps(time.isoformat())
startedquiz[quizId][request.user] = (question, fs, jtime)
return HttpResponse('')
\ No newline at end of file
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