You need to sign in or sign up before continuing.
Commit dd719b58 authored by Samarth Joshi's avatar Samarth Joshi

Changing quiz start date to take input from Instructor

parent 39f9dee4
No preview for this file type
# Generated by Django 3.1.2 on 2020-10-24 10:20
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('quiz', '0003_auto_20201024_0927'),
]
operations = [
migrations.AlterField(
model_name='quiz',
name='startTime',
field=models.DateTimeField(),
),
]
...@@ -4,7 +4,7 @@ from django.db import models ...@@ -4,7 +4,7 @@ from django.db import models
from django.db import models from django.db import models
class quiz(models.Model): class quiz(models.Model):
quizId=models.AutoField(default=0, primary_key=True) #primary key quizId=models.AutoField(default=0, primary_key=True) #primary key
startTime=models.DateTimeField(auto_now_add=True) startTime=models.DateTimeField()
length=models.FloatField(max_length=10) length=models.FloatField(max_length=10)
quizCode=models.CharField(max_length=100) ##quiz Code set by instructor quizCode=models.CharField(max_length=100) ##quiz Code set by instructor
quizDone=models.BooleanField(default=False) quizDone=models.BooleanField(default=False)
......
...@@ -4,6 +4,8 @@ var current_question = 0; ...@@ -4,6 +4,8 @@ var current_question = 0;
var questions = document.getElementById('questions_area_wrapper').children; var questions = document.getElementById('questions_area_wrapper').children;
questions[current_question].style.display = 'block'; questions[current_question].style.display = 'block';
var questions_len = parseInt(document.getElementById('question_count').value); var questions_len = parseInt(document.getElementById('question_count').value);
var selected_color = '#f4fa9c';
var deselected_color = '#ffffff';
function next_question () { function next_question () {
...@@ -34,14 +36,27 @@ function goto_question(x) { ...@@ -34,14 +36,27 @@ function goto_question(x) {
} }
} }
function set_option( question_id, option_id ,value) { function set_option( question_id, option_id ) {
if(typeof question_id == "number" && typeof option_id == "number") { if(typeof question_id == "number" && typeof option_id == "number") {
if(question_id>=0 && question_id<questions_len && option_id>=0 && option_id<4) { if(question_id>=0 && question_id<questions_len && option_id>=0 && option_id<4) {
var ans = document.getElementById('q'+question_id); var ans = document.getElementById('q'+question_id);
ans.value = value; if (ans.value == "NA") {
var cbox = document.getElementById("lbl_"+question_id+"_"+option_id); ans.value = option_id;
console.log("lbl_"+question_id+"_"+option_id); var cbox = document.getElementById("lbl_"+question_id+"_"+option_id);
cbox.style.backgroundColor = '#f4fa9c'; cbox.style.backgroundColor = selected_color;
} else {
if(option_id == ans.value) {
var obox = document.getElementById("lbl_"+question_id+"_"+ans.value);
obox.style.backgroundColor = deselected_color;
ans.value = "NA";
} else {
var obox = document.getElementById("lbl_"+question_id+"_"+ans.value);
obox.style.backgroundColor = deselected_color;
ans.value = option_id;
var cbox = document.getElementById("lbl_"+question_id+"_"+option_id);
cbox.style.backgroundColor = selected_color;
}
}
} }
} }
} }
\ 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