summaryrefslogtreecommitdiff
path: root/yaksh/models.py
diff options
context:
space:
mode:
authorPrabhu Ramachandran2017-10-25 15:44:38 +0530
committerGitHub2017-10-25 15:44:38 +0530
commit48f8c2b504f028e3b73622e47ba357c643f05174 (patch)
treefdf032726b80015925a19cb35aaf15b68295e8b1 /yaksh/models.py
parent07e5a3c831ad351d47de54db7179303be3506c10 (diff)
parentb82a1a25e62d7eb73f16512dc8fc5a9985596dca (diff)
downloadonline_test-48f8c2b504f028e3b73622e47ba357c643f05174.tar.gz
online_test-48f8c2b504f028e3b73622e47ba357c643f05174.tar.bz2
online_test-48f8c2b504f028e3b73622e47ba357c643f05174.zip
Merge pull request #369 from maheshgudi/0.7_bugfix
Grade User bugfix
Diffstat (limited to 'yaksh/models.py')
-rw-r--r--yaksh/models.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/yaksh/models.py b/yaksh/models.py
index ff326d3..d02b6d6 100644
--- a/yaksh/models.py
+++ b/yaksh/models.py
@@ -506,8 +506,20 @@ class Question(models.Model):
tmp_file_path = tempfile.mkdtemp()
yaml_path = os.path.join(tmp_file_path, "questions_dump.yaml")
for elem in q_dict:
- sorted_dict = CommentedMap(sorted(elem.items(), key=lambda x:x[0]))
- yaml_block = dict_to_yaml(sorted_dict)
+ relevant_dict = CommentedMap()
+ irrelevant_dict = CommentedMap()
+ relevant_dict['summary'] = elem.pop('summary')
+ relevant_dict['type'] = elem.pop('type')
+ relevant_dict['language'] = elem.pop('language')
+ relevant_dict['description'] = elem.pop('description')
+ relevant_dict['points'] = elem.pop('points')
+ relevant_dict['testcase'] = elem.pop('testcase')
+ relevant_dict.update(CommentedMap(sorted(elem.items(),
+ key=lambda x:x[0]
+ ))
+ )
+
+ yaml_block = dict_to_yaml(relevant_dict)
with open(yaml_path, "a") as yaml_file:
yaml_file.write(yaml_block)
zip_file.write(yaml_path, os.path.basename(yaml_path))
@@ -1097,6 +1109,7 @@ class AnswerPaperManager(models.Manager):
def get_users_for_questionpaper(self, questionpaper_id):
return self._get_answerpapers_for_quiz(questionpaper_id, status=True)\
.values("user__id", "user__first_name", "user__last_name")\
+ .order_by("user__first_name")\
.distinct()
def get_user_all_attempts(self, questionpaper, user):