diff options
author | Palaparthy Adityachandra | 2020-05-13 16:32:29 +0530 |
---|---|---|
committer | GitHub | 2020-05-13 16:32:29 +0530 |
commit | 61d4096697a84873473ad28afb0dc79f211a54b3 (patch) | |
tree | 117068fb9a2ddef2a3a2dc81567ff07a3069f0bf /yaksh | |
parent | 31e8b94b8ebf74d77cc8596411c6acfa2112f949 (diff) | |
parent | b264b673a2f84def1b9736a7a596b1acd5bb4d72 (diff) | |
download | online_test-61d4096697a84873473ad28afb0dc79f211a54b3.tar.gz online_test-61d4096697a84873473ad28afb0dc79f211a54b3.tar.bz2 online_test-61d4096697a84873473ad28afb0dc79f211a54b3.zip |
Merge branch 'master' into change-create_question
Diffstat (limited to 'yaksh')
-rw-r--r-- | yaksh/models.py | 14 | ||||
-rw-r--r-- | yaksh/static/yaksh/css/custom.css | 12 | ||||
-rw-r--r-- | yaksh/templates/yaksh/grade_user.html | 54 |
3 files changed, 66 insertions, 14 deletions
diff --git a/yaksh/models.py b/yaksh/models.py index d67a8e3..69894a2 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -1455,6 +1455,19 @@ class Question(models.Model): tc_list.extend(test_case) return tc_list + def get_test_cases_as_dict(self, **kwargs): + tc_list = [] + for tc in self.testcase_set.values_list("type", flat=True).distinct(): + test_case_ctype = ContentType.objects.get(app_label="yaksh", + model=tc) + test_case = test_case_ctype.get_all_objects_for_this_type( + question=self, + **kwargs + ) + for tc in test_case: + tc_list.append(model_to_dict(tc)) + return tc_list + def get_test_case(self, **kwargs): for tc in self.testcase_set.all(): test_case_type = tc.type @@ -1746,6 +1759,7 @@ class QuestionPaper(models.Model): for question_set in self.random_questions.all(): marks += question_set.marks * question_set.num_questions self.total_marks = marks + self.save() def _get_questions_for_answerpaper(self): """ Returns fixed and random questions for the answer paper""" diff --git a/yaksh/static/yaksh/css/custom.css b/yaksh/static/yaksh/css/custom.css index a9c8e27..f995c61 100644 --- a/yaksh/static/yaksh/css/custom.css +++ b/yaksh/static/yaksh/css/custom.css @@ -98,6 +98,13 @@ body, .dropdown-menu { transition: all 0.3s; } +@media (min-width: 1024px) { + + .students-list { + position: fixed !important; + } +} + /* --------------------------------------------------- FORUM STYLE ----------------------------------------------------- */ @@ -118,10 +125,9 @@ body, .dropdown-menu { .description { font-size: 16px; } - /* --------------------------------------------------- - Quiz qusetion style + Quiz question style ----------------------------------------------------- */ #question_card { border: none; -}
\ No newline at end of file +} diff --git a/yaksh/templates/yaksh/grade_user.html b/yaksh/templates/yaksh/grade_user.html index 7206525..f4c7d67 100644 --- a/yaksh/templates/yaksh/grade_user.html +++ b/yaksh/templates/yaksh/grade_user.html @@ -15,7 +15,24 @@ $(document).ready(function() { $("#marks_table").tablesorter({sortList: [[2,1]]}); }); +function searchNames() { + var input, filter, ul, li, a, i, txtValue; + input = document.getElementById('myInput'); + filter = input.value.toUpperCase(); + $("#myUL").toggle(); + ul = document.getElementById("myUL"); + li = ul.getElementsByTagName('li'); + for (i = 0; i < li.length; i++) { + a = li[i].getElementsByTagName("a")[0]; + txtValue = a.textContent || a.innerText; + if (txtValue.toUpperCase().indexOf(filter) > -1) { + li[i].style.display = ""; + } else { + li[i].style.display = "none"; + } + } +} </script> {% endblock script %} @@ -87,16 +104,17 @@ $(document).ready(function() <div class="row"> {% if status == "grade" %} {% if users %} - <div id="student" class="col-md-3"> - <ul class="nav nav-pills list-group"> - {% for user in users %} - <li class="nav-item"> - <a href="{% url 'yaksh:grade_user' quiz_id user.user__id course_id %}" class="list-group-item{% if user.user__id == data.user.id %} active {% endif %}"> - {{user.user__first_name}} {{user.user__last_name}} - </a> - </li> - {% endfor %} - </ul> + <div id="student" class="col-lg-3"> + <div class="students-list"> + <select onchange="window.location.href=this.value" class="custom-select"> + <option value="">Select student</option> + {% for user in users %} + <option value="{% url 'yaksh:grade_user' quiz_id user.user__id course_id %}" {% if user.user__id == data.user.id %} selected {% endif %} title="{{user.user__first_name|upper}} {{user.user__last_name|upper}}"> + {{user.user__first_name|upper}} {{user.user__last_name|truncatechars:5|upper}} + </option> + {% endfor %} + </select> + </div> </div> {% else %} <div class="col-md-1"></div> @@ -110,7 +128,7 @@ $(document).ready(function() {% endif %} {% endif %} - <div id="paper" class="col-md-9"> + <div id="paper" class="col-lg-9"> {% if has_quiz_assignments %} <a href="{% url 'yaksh:download_quiz_assignment' quiz_id course_id %}" class="btn btn-outline-info"> <i class="fa fa-download"></i> Download All Assignments @@ -128,8 +146,22 @@ $(document).ready(function() </div> {% endfor %} {% endif %} + {% if status == "grade" and users %} + <input type="text" id="myInput" onkeyup="searchNames()" placeholder="Type to search for names" class="form-control"> + <ul class="nav nav-pills list-group" style="display: none;" id="myUL"> + {% for user in users %} + <li class="nav-item"> + <a href="{% url 'yaksh:grade_user' quiz_id user.user__id course_id %}" class="list-group-item"> + {{user.user__first_name|upper}} {{user.user__last_name|upper}} + </a> + </li> + {% endfor %} + <br> + </ul> + {% endif %} {% if data %} + <hr> <div class="card"> <div class="card-header"> Student Details |