summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--yaksh/forms.py3
-rw-r--r--yaksh/templates/yaksh/question.html7
-rw-r--r--yaksh/views.py4
3 files changed, 11 insertions, 3 deletions
diff --git a/yaksh/forms.py b/yaksh/forms.py
index e53eda3..7eae673 100644
--- a/yaksh/forms.py
+++ b/yaksh/forms.py
@@ -35,6 +35,9 @@ question_types = (
("integer", "Answer in Integer"),
("string", "Answer in String"),
("float", "Answer in Float"),
+ ("arrange", "Arrange Options in Order"),
+
+
)
test_case_types = (
diff --git a/yaksh/templates/yaksh/question.html b/yaksh/templates/yaksh/question.html
index ed04963..e67a260 100644
--- a/yaksh/templates/yaksh/question.html
+++ b/yaksh/templates/yaksh/question.html
@@ -257,11 +257,14 @@ question_type = "{{ question.type }}"
{% if question.type == "arrange" %}
<input name="answer" type="hidden" id='arrange_order'/>
+ <div class="list-group">
<ol class="arrange">
{% for test_case in test_cases %}
- <li id = {{test_case.id}}>{{test_case.options| safe }}</li>
+ <li class="list-group-item" id={{test_case.id}}>{{test_case.options| safe }}</li>
{% endfor %}
- </ol>
+ </ol>
+ </div>
+
<script type="text/javascript">
var arrange = $("ol.arrange");
var order_array = $(arrange).sortable(['serialize']);
diff --git a/yaksh/views.py b/yaksh/views.py
index 5c88391..9a66f09 100644
--- a/yaksh/views.py
+++ b/yaksh/views.py
@@ -242,6 +242,8 @@ def add_question(request, question_id=None):
if qform.is_valid():
question = qform.save(commit=False)
question.user = user
+ if question.type == "arrange":
+ question.shuffle_testcases = True
question.save()
# many-to-many field save function used to save the tags
qform.save_m2m()
@@ -616,7 +618,7 @@ def show_question(request, question, paper, error_message=None, notification=Non
if question.type == "code" else
'You have already attempted this question'
)
- if question.type in ['mcc', 'mcq']:
+ if question.type in ['mcc', 'mcq', 'arrange']:
test_cases = question.get_ordered_test_cases(paper)
else:
test_cases = question.get_test_cases()