diff options
author | Prabhu Ramachandran | 2018-03-22 18:09:03 +0530 |
---|---|---|
committer | GitHub | 2018-03-22 18:09:03 +0530 |
commit | 734b221a98745ccb6218f43923731323a265966a (patch) | |
tree | b9ad94f07ae3891295656203c169cb0b03b08d96 /yaksh/templates | |
parent | 4b356aa2f6097cd0f46292218f31ded18b631e53 (diff) | |
parent | 09ab00808ba9ea288047662e5c7ee2a134f0ac41 (diff) | |
download | online_test-734b221a98745ccb6218f43923731323a265966a.tar.gz online_test-734b221a98745ccb6218f43923731323a265966a.tar.bz2 online_test-734b221a98745ccb6218f43923731323a265966a.zip |
Merge pull request #434 from maheshgudi/arrange_options
Arrange options question type
Diffstat (limited to 'yaksh/templates')
-rw-r--r-- | yaksh/templates/yaksh/add_question.html | 1 | ||||
-rw-r--r-- | yaksh/templates/yaksh/grade_user.html | 19 | ||||
-rw-r--r-- | yaksh/templates/yaksh/question.html | 29 | ||||
-rw-r--r-- | yaksh/templates/yaksh/user_data.html | 18 | ||||
-rw-r--r-- | yaksh/templates/yaksh/view_answerpaper.html | 21 |
5 files changed, 83 insertions, 5 deletions
diff --git a/yaksh/templates/yaksh/add_question.html b/yaksh/templates/yaksh/add_question.html index ed69657..79c132c 100644 --- a/yaksh/templates/yaksh/add_question.html +++ b/yaksh/templates/yaksh/add_question.html @@ -64,6 +64,7 @@ <option value="integertestcase">Integer </option> <option value="stringtestcase"> String </option> <option value="floattestcase"> Float </option> + <option value="arrangetestcase">Arrange options </option> </select></p> <center> <button class="btn" type="submit" name="save_question">Save</button> diff --git a/yaksh/templates/yaksh/grade_user.html b/yaksh/templates/yaksh/grade_user.html index 93f00e0..8430e91 100644 --- a/yaksh/templates/yaksh/grade_user.html +++ b/yaksh/templates/yaksh/grade_user.html @@ -167,7 +167,7 @@ Status : <b style="color: red;"> Failed </b><br/> {% endif %} {% endfor %} - {% elif question.type == "integer" or "string" or "float" %} + {% elif question.type == "integer" or question.type == "string" or question.type == "float" %} <h5> <u>Correct Answer:</u></h5> {% for testcase in question.get_test_cases %} <strong>{{ testcase.correct|safe }}</strong> @@ -175,6 +175,14 @@ Status : <b style="color: red;"> Failed </b><br/> <strong>{{ testcase.error_margin|safe }}</strong> {% endif %} {% endfor %} + {% elif question.type == "arrange" %} + <h5> <u>Correct Order:</u></h5> + <div class="list-group" > + {% for testcase in question.get_test_cases %} + <li class="list-group-item"><strong>{{ testcase.options|safe }}</strong></li> + {% endfor %} + </div> + {% else %} <h5> <u>Test cases: </u></h5> {% for testcase in question.get_test_cases %} @@ -307,6 +315,15 @@ Status : <b style="color: red;"> Failed </b><br/> {% endif %} {% endfor %} </div> + + {% elif question.type == "arrange"%} + <div class="well well-sm"> + {% get_answer_for_arrange_options ans.answer.answer question as tc_list %} + {% for testcases in tc_list %} + <li>{{ testcases.options.strip|safe }}</li> + {% endfor %} + </div> + {% else %} <div class="well well-sm"> {{ ans.answer.answer.strip|safe }} diff --git a/yaksh/templates/yaksh/question.html b/yaksh/templates/yaksh/question.html index 9d6ce48..b65073a 100644 --- a/yaksh/templates/yaksh/question.html +++ b/yaksh/templates/yaksh/question.html @@ -21,6 +21,7 @@ <script src="{{ URL_ROOT }}/static/yaksh/js/codemirror/mode/clike/clike.js"></script> <script src="{{ URL_ROOT }}/static/yaksh/js/codemirror/mode/shell/shell.js"></script> <script src="{{ URL_ROOT }}/static/yaksh/js/mathjax/MathJax.js?config=TeX-MML-AM_CHTML"></script> +<script src="{{ URL_ROOT }}/static/yaksh/js/jquery-sortable.js"></script> <script> init_val = '{{ last_attempt|escape_quotes|safe }}'; lang = "{{ question.language }}" @@ -175,10 +176,12 @@ question_type = "{{ question.type }}" {% else %} <h5>(CASE SENSITIVE)</h5> {% endif %} - {% elif question.type == "float" %} (FILL IN THE BLANKS WITH FLOAT ANSWER) + {% elif question.type == "arrange" %} + (ARRANGE THE OPTIONS IN CORRECT ORDER) {% endif %} + </u> <font class=pull-right>(Marks : {{ question.points }}) </font> </h4> @@ -251,6 +254,27 @@ question_type = "{{ question.type }}" <input type=file id="assignment" name="assignment" multiple=""> <hr> {% endif %} + + {% if question.type == "arrange" %} + {% if last_attempt %} + {% get_answer_for_arrange_options last_attempt question as test_cases %} + {% endif %} + <input name="answer" type="hidden" id='arrange_order'/> + <div class="list-group"> + <ol class="arrange"> + {% for test_case in test_cases %} + <li class="list-group-item" id={{test_case.id}}>{{test_case.options| safe }}</li> + {% endfor %} + </ol> + </div> + + <script type="text/javascript"> + var arrange = $("ol.arrange"); + var order_array = $(arrange).sortable(['serialize']); + </script> + {% endif %} + + {% if question.type == "code" %} <div class="row"> <div class="col-md-9"> @@ -269,6 +293,9 @@ question_type = "{{ question.type }}" <br><button class="btn btn-primary" type="submit" name="check" id="check">Submit Answer</button> {% elif question.type == "upload" %} <br><button class="btn btn-primary" type="submit" name="check" id="check" onClick="return validate();">Upload</button> + {% elif question.type == "arrange" %} + <br><button class="btn btn-primary" type="submit" name="check" id="check" onClick="return user_arranged_options();">Submit Answer</button> + {% else %} {% if question in paper.get_questions_unanswered or quiz.is_exercise %} diff --git a/yaksh/templates/yaksh/user_data.html b/yaksh/templates/yaksh/user_data.html index ce2533e..9449fcc 100644 --- a/yaksh/templates/yaksh/user_data.html +++ b/yaksh/templates/yaksh/user_data.html @@ -80,6 +80,13 @@ User IP address: {{ paper.user_ip }} <strong>{{ testcase.correct|safe }}</strong> {% endfor %} + {% elif question.type == "arrange" %} + <h5> <u>Correct Order:</u></h5> + <div class="list-group" > + {% for testcase in question.get_test_cases %} + <li class="list-group-item"><strong>{{ testcase.options|safe }}</strong></li> + {% endfor %} + </div> {% else %} <h5> <u>Test cases: </u></h5> @@ -99,6 +106,7 @@ User IP address: {{ paper.user_ip }} {% endif %} <div class="panel-body"> <h5><u>Student answer:</u></h5> + {% if question.type == "mcc"%} <div class="well well-sm"> {% for testcases in question.get_test_cases %} @@ -107,6 +115,7 @@ User IP address: {{ paper.user_ip }} {% endif %} {% endfor %} </div> + {% elif question.type == "mcq"%} <div class="well well-sm"> {% for testcases in question.get_test_cases %} @@ -115,6 +124,15 @@ User IP address: {{ paper.user_ip }} {% endif %} {% endfor %} </div> + + {% elif question.type == "arrange"%} + <div class="well well-sm"> + {% get_answer_for_arrange_options answers.0.answer question as tc_list %} + {% for testcases in tc_list %} + <li>{{ testcases.options.strip|safe }}</li> + {% endfor %} + </div> + {%else%} <div class="well well-sm"> {{ answers.0.answer|safe }} diff --git a/yaksh/templates/yaksh/view_answerpaper.html b/yaksh/templates/yaksh/view_answerpaper.html index 971ef77..7cbec91 100644 --- a/yaksh/templates/yaksh/view_answerpaper.html +++ b/yaksh/templates/yaksh/view_answerpaper.html @@ -35,9 +35,9 @@ End time : {{ paper.end_time }} <br/> Percentage obtained: {{ paper.percent }}% <br/> {% if paper.passed %} - Status : <b style="color: red;"> Failed </b><br/> - {% else %} Status : <b style="color: green;"> Passed </b><br/> + {% else %} + Status : <b style="color: red;"> Failed </b><br/> {% endif %} </p> @@ -67,12 +67,20 @@ {% endif %} {% endfor %} - {% elif question.type == "integer" or "string" or "float" %} + {% elif question.type == "integer" or question.type == "string" or question.type == "float" %} <h5> <u>Correct Answer:</u></h5> {% for testcase in question.get_test_cases %} <strong>{{ testcase.correct|safe }}</strong> {% endfor %} + {% elif question.type == "arrange" %} + <h5> <u>Correct Order:</u></h5> + <div class="list-group"> + {% for testcase in question.get_test_cases %} + <li class="list-group-item"><strong>{{ testcase.options|safe }}</strong></li> + {% endfor %} + </div> + {% else %} <h5> <u>Test cases: </u></h5> {% for testcase in question.get_test_cases %} @@ -108,6 +116,13 @@ {% endif %} {% endfor %} </div> + {% elif question.type == "arrange"%} + <div class="well well-sm"> + {% get_answer_for_arrange_options answers.0.answer question as tc_list %} + {% for testcases in tc_list %} + <li>{{ testcases.options.strip|safe }}</li> + {% endfor %} + </div> {% elif question.type == "upload" and has_user_assignment %} <a href="{{URL_ROOT}}/exam/download/user_assignment/{{question.id}}/{{data.user.id}}/{{paper.question_paper.quiz.id}}"> <div class="well well-sm"> |