diff options
author | maheshgudi | 2018-03-07 19:36:03 +0530 |
---|---|---|
committer | maheshgudi | 2018-03-16 15:15:50 +0530 |
commit | df7bfb4e4900028831fb3563e998891ef5d0229d (patch) | |
tree | e57e20c093e3ead53dfa0261b1b72f3cf6dc371e | |
parent | 2feec77152518f5f60ddfc46bb22857278c1d7ba (diff) | |
download | online_test-df7bfb4e4900028831fb3563e998891ef5d0229d.tar.gz online_test-df7bfb4e4900028831fb3563e998891ef5d0229d.tar.bz2 online_test-df7bfb4e4900028831fb3563e998891ef5d0229d.zip |
Remove lists from variable name
-rw-r--r-- | yaksh/models.py | 2 | ||||
-rw-r--r-- | yaksh/templatetags/custom_filters.py | 10 | ||||
-rw-r--r-- | yaksh/test_models.py | 12 | ||||
-rw-r--r-- | 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 |