summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoradityacp2021-01-28 10:40:40 +0530
committeradityacp2021-01-28 10:40:40 +0530
commit164d4d79787f3f6ef21a213bd647e885bf1cc899 (patch)
tree2af42ede4d5bb8afa475cb64ada4e9899000dac2
parentfa8020b9f39b4e75a0a5d8b26653cc61cb9ae981 (diff)
downloadonline_test-164d4d79787f3f6ef21a213bd647e885bf1cc899.tar.gz
online_test-164d4d79787f3f6ef21a213bd647e885bf1cc899.tar.bz2
online_test-164d4d79787f3f6ef21a213bd647e885bf1cc899.zip
Minor template changes
-rw-r--r--yaksh/templates/yaksh/courses.html12
-rw-r--r--yaksh/templates/yaksh/post_comments.html4
-rw-r--r--yaksh/templates/yaksh/question.html32
-rw-r--r--yaksh/templates/yaksh/quizzes_user.html4
-rw-r--r--yaksh/templates/yaksh/show_lesson_quiz.html28
-rw-r--r--yaksh/views.py15
6 files changed, 45 insertions, 50 deletions
diff --git a/yaksh/templates/yaksh/courses.html b/yaksh/templates/yaksh/courses.html
index 38c106c..0c59b2b 100644
--- a/yaksh/templates/yaksh/courses.html
+++ b/yaksh/templates/yaksh/courses.html
@@ -213,13 +213,15 @@
{{course.name}}
</div>
<div class="col-md-3">
- <span class="badge badge-pill badge-info">
- {% if user.id != course.creator.id %}
+ {% if user.id != course.creator.id %}
+ <span class="badge badge-pill badge-warning">
Allotted Course
- {% else %}
+ </span>
+ {% else %}
+ <span class="badge badge-pill badge-primary">
Created Course
- {% endif %}
- </span>
+ </span>
+ {% endif %}
</div>
<div class="col-md-2">
{% if course.active %}
diff --git a/yaksh/templates/yaksh/post_comments.html b/yaksh/templates/yaksh/post_comments.html
index aadc48b..17576b8 100644
--- a/yaksh/templates/yaksh/post_comments.html
+++ b/yaksh/templates/yaksh/post_comments.html
@@ -25,8 +25,8 @@
</center>
</div>
{% endif %}
- <div class="card mb-2 border-dark">
- <div class="card-header text-white bg-dark py-2 px-3">
+ <div class="card mb-2">
+ <div class="card-header py-2 px-3">
{{post.title}}
<br>
<small>
diff --git a/yaksh/templates/yaksh/question.html b/yaksh/templates/yaksh/question.html
index 67bbf3f..56edcf3 100644
--- a/yaksh/templates/yaksh/question.html
+++ b/yaksh/templates/yaksh/question.html
@@ -158,28 +158,18 @@ question_type = "{{ question.type }}";
{% else %}
<small class="textx text-muted"><strong>Language:</strong> <span class="badge badge-primary">{{question.language}}</span></small>
{% endif %}
- {% if question.type == "mcq" %}
- <small class="text text-muted"><strong>Type:</strong> <span class="badge badge-primary">SINGLE CORRECT CHOICE</span></small>
- {% elif question.type == "mcc" %}
- <small class="text text-muted"><strong>Type:</strong> <span class="badge badge-primary">MULTIPLE CORRECT CHOICES</span></small>
- {% elif question.type == "code" %}
- <small class="text text-muted"><strong>Type:</strong> <span class="badge badge-primary">PROGRAMMING</span></small>
- {% elif question.type == "upload" %}
- <small class="text text-muted"><strong>Type:</strong> <span class="badge badge-primary">ASSIGNMENT UPLOAD</span></small>
- {% elif question.type == "integer" %}
- <small class="text text-muted"><strong>Type:</strong> <span class="badge badge-primary">FILL IN THE BLANKS WITH INTEGER ANSWER</span></small>
- {% elif question.type == "string" %}
- <small class="text text-muted"><strong>Type:</strong> <span class="badge badge-primary">FILL IN THE BLANKS WITH STRING ANSWER</span></small>
- {% if testcase.string_check == "lower" %}
- <br>(CASE INSENSITIVE)
- {% else %}
- <br>(CASE SENSITIVE)
+ <small class="text text-muted"><strong>Type:</strong>
+ <span class="badge badge-primary">
+ {{question.get_type_display}}
+ {% if question.type == "string" %}
+ {% if testcase.string_check == "lower" %}
+ (CASE INSENSITIVE)
+ {% else %}
+ (CASE SENSITIVE)
+ {% endif %}
{% endif %}
- {% elif question.type == "float" %}
- <small class="text text-muted"><strong>Type:</strong> <span class="badge badge-primary">FILL IN THE BLANKS WITH FLOAT ANSWER</span></small>
- {% elif question.type == "arrange" %}
- <small class="text text-muted"><strong>Type:</strong> <span class="badge badge-primary">ARRANGE THE OPTIONS IN CORRECT ORDER</span></small>
- {% endif %}
+ </span>
+ </small>
<span class="badge badge-info pull-right">
<small><strong>Marks: {{ question.points }}</strong></small>
</span>
diff --git a/yaksh/templates/yaksh/quizzes_user.html b/yaksh/templates/yaksh/quizzes_user.html
index b1c5e3c..3dfcbac 100644
--- a/yaksh/templates/yaksh/quizzes_user.html
+++ b/yaksh/templates/yaksh/quizzes_user.html
@@ -67,7 +67,7 @@
</div>
<div class="col-md-2">
{% if user in course.data.requests.all %}
- <span class="badge badge-warning badge-pill">
+ <span class="badge badge-primary badge-pill">
Request Pending
</span>
{% elif user in course.data.rejected.all %}
@@ -94,7 +94,7 @@
{% endif %}
{% else %}
<span class="badge badge-danger badge-pill">
- Enrollment Closed
+ No Enrollments allowed
</span>
{% endif %}
{% else %}
diff --git a/yaksh/templates/yaksh/show_lesson_quiz.html b/yaksh/templates/yaksh/show_lesson_quiz.html
index 71c997d..48765bd 100644
--- a/yaksh/templates/yaksh/show_lesson_quiz.html
+++ b/yaksh/templates/yaksh/show_lesson_quiz.html
@@ -35,24 +35,18 @@
{% else %}
<small class="textx text-muted"><strong>Language:</strong> <span class="badge badge-primary">{{question.language}}</span></small>
{% endif %}
- {% if question.type == "mcq" %}
- <small class="text text-muted"><strong>Type:</strong> <span class="badge badge-primary">SINGLE CORRECT CHOICE</span></small>
- {% elif question.type == "mcc" %}
- <small class="text text-muted"><strong>Type:</strong> <span class="badge badge-primary">MULTIPLE CORRECT CHOICES</span></small>
- {% elif question.type == "integer" %}
- <small class="text text-muted"><strong>Type:</strong> <span class="badge badge-primary">FILL IN THE BLANKS WITH INTEGER ANSWER</span></small>
- {% elif question.type == "string" %}
- <small class="text text-muted"><strong>Type:</strong> <span class="badge badge-primary">FILL IN THE BLANKS WITH STRING ANSWER</span></small>
- {% if testcase.string_check == "lower" %}
- <br>(CASE INSENSITIVE)
- {% else %}
- <br>(CASE SENSITIVE)
+ <small class="text text-muted"><strong>Type:</strong>
+ <span class="badge badge-primary">
+ {{question.get_type_display}}
+ {% if question.type == "string" %}
+ {% if testcase.string_check == "lower" %}
+ (CASE INSENSITIVE)
+ {% else %}
+ (CASE SENSITIVE)
+ {% endif %}
{% endif %}
- {% elif question.type == "float" %}
- <small class="text text-muted"><strong>Type:</strong> <span class="badge badge-primary">FILL IN THE BLANKS WITH FLOAT ANSWER</span></small>
- {% elif question.type == "arrange" %}
- <small class="text text-muted"><strong>Type:</strong> <span class="badge badge-primary">ARRANGE THE OPTIONS IN CORRECT ORDER</span></small>
- {% endif %}
+ </span>
+ </small>
<span class="badge badge-info pull-right">
<small><strong>Points: {{ question.points }}</strong></small>
</span>
diff --git a/yaksh/views.py b/yaksh/views.py
index 2b5ea8d..83b6766 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -681,8 +681,9 @@ def show_question(request, question, paper, error_message=None,
delay_time = paper.time_left_on_question(question)
if previous_question and quiz.is_exercise:
- if (delay_time <= 0 or previous_question in
- paper.questions_answered.all()):
+ is_prev_que_answered = paper.questions_answered.filter(
+ id=previous_question.id).exists()
+ if (delay_time <= 0 or is_prev_que_answered):
can_skip = True
question = previous_question
if not question:
@@ -798,6 +799,14 @@ def check(request, q_id, attempt_num=None, questionpaper_id=None,
course_id=course_id
)
current_question = get_object_or_404(Question, pk=q_id)
+ def is_valid_answer(answer):
+ status = True
+ if ((current_question.type == "mcc" or
+ current_question.type == "arrange") and not answer):
+ status = False
+ elif answer is None or not str(answer):
+ status = False
+ return status
if request.method == 'POST':
# Add the answer submitted, regardless of it being correct or not.
@@ -877,7 +886,7 @@ def check(request, q_id, attempt_num=None, questionpaper_id=None,
previous_question=current_question)
else:
user_answer = request.POST.get('answer')
- if not str(user_answer):
+ if not is_valid_answer(user_answer):
msg = "Please submit a valid answer."
return show_question(
request, current_question, paper, notification=msg,