Commit 8cd457b2 authored by Roshan Rabinarayan's avatar Roshan Rabinarayan

added cribs to instructor module

parent f858fbe3
No preview for this file type
# Generated by Django 3.1.2 on 2020-11-06 05:34
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('quiz', '0004_result'),
]
operations = [
migrations.AlterModelTable(
name='cribs',
table='cribs',
),
migrations.AlterModelTable(
name='questions',
table='Questions',
),
]
......@@ -34,6 +34,8 @@ class Questions(models.Model):
def __str__(self):
return str(self.questionId)
class Meta:
db_table="Questions"
class submission(models.Model):
......@@ -48,6 +50,8 @@ class cribs(models.Model):
cribs=models.CharField(max_length=1000)
quizId=models.ForeignKey(quiz,to_field='quizId',on_delete=models.CASCADE)
questionId=models.ForeignKey(Questions,to_field='questionId',on_delete=models.CASCADE)
class Meta:
db_table="cribs"
class result(models.Model):
......
......@@ -3,6 +3,11 @@
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
table, th, td {
border: 1px solid black;
}
</style>
</head>
<body>
<h1>Hello Everyone</h1>
......@@ -12,6 +17,16 @@
{{graph|safe}}
{{graph1|safe}}
{{graph2|safe}}
<table >
<th>Question</th><th>StudentId</th><th>Cribs</th>
{%for crib in cribs%}
<tr>
<td>{{crib.0}}</td>
<td>{{crib.1}}</td>
<td>{{crib.2}}</td>
</tr>
{%endfor%}
</table>
</div>
</body>
</html>
\ No newline at end of file
......@@ -12,11 +12,14 @@ from .models import quiz
from django.db.models import Max
from django.shortcuts import redirect
from .models import result as results
from .models import cribs as crib
from django.db import connection, transaction
import numpy as np
import math
import pandas as pd
import scipy.stats as stats
import csv
from prettytable import PrettyTable
#for login
from django.contrib.auth.models import User
from django.contrib.auth.forms import UserCreationForm
......@@ -150,6 +153,12 @@ def instructor(request):
print(q_id)
students = results.objects.all().filter(quizId=q_id).values('studentId')
marks = results.objects.all().filter(quizId=q_id).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(q_id))
cribbs= list()
for cribb in cribs:
result=(cribb.question,cribb.studentId,cribb.cribs)
if result not in cribbs:
cribbs.append(result)
fig, ax = plt.subplots()
allMarks=list()
for mark in marks:
......@@ -168,7 +177,7 @@ def instructor(request):
x = np.linspace(mu - 3*sigma, mu + 3*sigma, 100)
ax1.plot(x, stats.norm.pdf(x, mu, sigma))
html_graph1 = mpld3.fig_to_html(fig1)
return render(request, 'instructor.html',{"graph": html_graph, "graph1": html_graph, "graph2": html_graph1,'quiz_id':q_id})
return render(request, 'instructor.html',{"graph": html_graph, "graph1": html_graph, "graph2": html_graph1,'quiz_id':q_id,'cribs':cribbs})
def handle_uploaded_file(f,q1):
......
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