summaryrefslogtreecommitdiff
path: root/testapp/exam/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'testapp/exam/models.py')
-rw-r--r--testapp/exam/models.py15
1 files changed, 8 insertions, 7 deletions
diff --git a/testapp/exam/models.py b/testapp/exam/models.py
index 88ba9ef..ebf1018 100644
--- a/testapp/exam/models.py
+++ b/testapp/exam/models.py
@@ -30,11 +30,10 @@ question_types = (
("mcq", "Multiple Choice"),
("mcc", "Multiple Correct Choices"),
("code", "Code"),
- ("basgn", "Bash Assignment"),
+ ("upload", "Assignment Upload"),
)
attempts = [(i, i) for i in range(1, 6)]
attempts.append((-1, 'Infinite'))
-
days_between_attempts = ((j, j) for j in range(401))
test_status = (
@@ -42,9 +41,11 @@ test_status = (
('completed', 'Completed'),
)
+
def get_assignment_dir(instance, filename):
return '%s/%s' % (instance.user.roll_number, instance.assignmentQuestion.id)
+
###############################################################################
class Question(models.Model):
"""Question for a quiz."""
@@ -189,9 +190,9 @@ class QuestionPaper(models.Model):
questions += question_set.get_random_questions()
return questions
- def make_answerpaper(self, user, ip, attempt_no):
+ def make_answerpaper(self, user, ip, attempt_num):
"""Creates an answer paper for the user to attempt the quiz"""
- ans_paper = AnswerPaper(user=user, user_ip=ip, attempt_number=attempt_no)
+ ans_paper = AnswerPaper(user=user, user_ip=ip, attempt_number=attempt_num)
ans_paper.start_time = datetime.datetime.now()
ans_paper.end_time = ans_paper.start_time \
+ datetime.timedelta(minutes=self.quiz.duration)
@@ -358,7 +359,7 @@ class AnswerPaper(models.Model):
Checks whether student passed or failed, as per the quiz
passing criteria.
"""
- if self.percent is not None:
+ if self.percent is not None:
if self.percent >= self.question_paper.quiz.pass_criteria:
self.passed = True
else:
@@ -385,9 +386,9 @@ class AnswerPaper(models.Model):
def __unicode__(self):
u = self.user
return u'Question paper for {0} {1}'.format(u.first_name, u.last_name)
-
-################################################################################
+
+###############################################################################
class AssignmentUpload(models.Model):
user = models.ForeignKey(Profile)
assignmentQuestion = models.ForeignKey(Question)