From df7bfb4e4900028831fb3563e998891ef5d0229d Mon Sep 17 00:00:00 2001 From: maheshgudi Date: Wed, 7 Mar 2018 19:36:03 +0530 Subject: Remove lists from variable name --- yaksh/models.py | 2 +- yaksh/templatetags/custom_filters.py | 10 +++++----- yaksh/test_models.py | 12 ++++++------ yaksh/views.py | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/yaksh/models.py b/yaksh/models.py index b267641..9dc1ede 100644 --- a/yaksh/models.py +++ b/yaksh/models.py @@ -71,7 +71,7 @@ test_case_types = ( ("integertestcase", "Integer Testcase"), ("stringtestcase", "String Testcase"), ("floattestcase", "Float Testcase"), - ("arrangetestcase", "Arrange Options Testcase"), + ("arrangetestcase", "Arrange Testcase"), ) string_check_type = ( diff --git a/yaksh/templatetags/custom_filters.py b/yaksh/templatetags/custom_filters.py index 2696ae4..26646b1 100644 --- a/yaksh/templatetags/custom_filters.py +++ b/yaksh/templatetags/custom_filters.py @@ -75,9 +75,9 @@ def get_answer_for_arrange_options(ans, question): ans = ans.decode("utf-8") else: ans = str(ans) - ans_list = literal_eval(ans) - testcase_list = [] - for answer_id in ans_list: + answer = literal_eval(ans) + testcases = [] + for answer_id in answer: tc = question.get_test_case(id=int(answer_id)) - testcase_list.append(tc) - return testcase_list + testcases.append(tc) + return testcases diff --git a/yaksh/test_models.py b/yaksh/test_models.py index bebc929..39a90d1 100644 --- a/yaksh/test_models.py +++ b/yaksh/test_models.py @@ -1379,13 +1379,13 @@ class AnswerPaperTestCases(unittest.TestCase): error_list = [json.loads(ans.error) for ans in answers_saved] if answers_saved: self.assertEqual(len(answered[question]), len(answers_saved)) - ans_list = [] - err_list = [] + ans = [] + err = [] for val in answered[question]: - ans_list.append(val.get('answer')) - err_list.append(val.get('error_list')) - self.assertEqual(set(ans_list), set(answers_saved)) - self.assertEqual(error_list, err_list) + ans.append(val.get('answer')) + err.append(val.get('error_list')) + self.assertEqual(set(ans), set(answers_saved)) + self.assertEqual(error_list, err) def test_is_answer_correct(self): self.assertTrue(self.answerpaper.is_answer_correct(self.questions[0])) diff --git a/yaksh/views.py b/yaksh/views.py index f644ac9..b97ae93 100644 --- a/yaksh/views.py +++ b/yaksh/views.py @@ -727,8 +727,8 @@ def check(request, q_id, attempt_num=None, questionpaper_id=None, elif current_question.type == 'mcc': user_answer = request.POST.getlist('answer') elif current_question.type == 'arrange': - user_answer_list = request.POST.get('answer').split(',') - user_answer = [int(ids) for ids in user_answer_list] + user_answer_ids = request.POST.get('answer').split(',') + user_answer = [int(ids) for ids in user_answer_ids] elif current_question.type == 'upload': # if time-up at upload question then the form is submitted without # validation -- cgit