From b3f5721f3cf4225902000f2f76e5138135383792 Mon Sep 17 00:00:00 2001 From: prathamesh Date: Thu, 8 Feb 2018 14:29:38 +0530 Subject: Add weightage for Quiz and Create Grading System App App Name: grades Grading System provides with the grade for a given value. It contains different grade ranges. Has its own default grading system. Allows you to modify and add grading system wth grade ranges. To be done: - Need to add README - Good UI - There are fields like can_be_used and order in models for future use. - More tests App name: Yaksh Now every quiz has a default weightage of 100%, can be changed. An aggregate is calculated for a given course. Using grades app a grade is provide to the aggregate value. --- grades/tests/test_models.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 grades/tests/test_models.py (limited to 'grades/tests/test_models.py') diff --git a/grades/tests/test_models.py b/grades/tests/test_models.py new file mode 100644 index 0000000..89708e2 --- /dev/null +++ b/grades/tests/test_models.py @@ -0,0 +1,27 @@ +from django.test import TestCase +from grades.models import GradingSystem, GradeRange + +# Create your tests here. +class GradingSystemTestCase(TestCase): + def setUp(self): + GradingSystem.objects.create(name='unusable') + + def test_get_grade(self): + # Given + grading_system = GradingSystem.objects.get(name='default') + expected_grades = {0:'F', 31:'F', 49:'P', 55:'C', 60:'B', 80:'A', + 95:'A+', 100:'A+', 100.5:'A+', 101:None, 109:None} + for marks in expected_grades.keys(): + # When + grade = grading_system.get_grade(marks) + # Then + self.assertEqual(expected_grades.get(marks), grade) + + def test_grade_system_unusable(self): + # Given + grading_system = GradingSystem.objects.get(name='unusable') + # When + grade = grading_system.get_grade(29) + # Then + self.assertIsNone(grade) + -- cgit From f06a5d2ffbb1a06320935841a4ba24720e651985 Mon Sep 17 00:00:00 2001 From: prathamesh Date: Tue, 13 Feb 2018 12:48:19 +0530 Subject: Change default grading system behaviour Cannot edit default system. Code as per PEP8 standards. Updates grade after regrade or manual grading Field change from total marks to percentage Removed unused fields from grades app --- grades/tests/test_models.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'grades/tests/test_models.py') diff --git a/grades/tests/test_models.py b/grades/tests/test_models.py index 89708e2..f8d5c5c 100644 --- a/grades/tests/test_models.py +++ b/grades/tests/test_models.py @@ -1,7 +1,7 @@ from django.test import TestCase from grades.models import GradingSystem, GradeRange -# Create your tests here. + class GradingSystemTestCase(TestCase): def setUp(self): GradingSystem.objects.create(name='unusable') @@ -9,8 +9,9 @@ class GradingSystemTestCase(TestCase): def test_get_grade(self): # Given grading_system = GradingSystem.objects.get(name='default') - expected_grades = {0:'F', 31:'F', 49:'P', 55:'C', 60:'B', 80:'A', - 95:'A+', 100:'A+', 100.5:'A+', 101:None, 109:None} + expected_grades = {0: 'F', 31: 'F', 49: 'P', 55: 'C', 60: 'B', 80: 'A', + 95: 'A+', 100: 'A+', 100.5: 'A+', 101: None, + 109: None} for marks in expected_grades.keys(): # When grade = grading_system.get_grade(marks) @@ -19,9 +20,9 @@ class GradingSystemTestCase(TestCase): def test_grade_system_unusable(self): # Given + # System with out ranges grading_system = GradingSystem.objects.get(name='unusable') # When grade = grading_system.get_grade(29) # Then self.assertIsNone(grade) - -- cgit From 97b657edc2a323f832c81f0e34ce5761bd21f7e9 Mon Sep 17 00:00:00 2001 From: adityacp Date: Thu, 24 May 2018 12:07:39 +0530 Subject: Pep8 changes --- grades/tests/test_models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'grades/tests/test_models.py') diff --git a/grades/tests/test_models.py b/grades/tests/test_models.py index f8d5c5c..a508eb3 100644 --- a/grades/tests/test_models.py +++ b/grades/tests/test_models.py @@ -1,5 +1,5 @@ from django.test import TestCase -from grades.models import GradingSystem, GradeRange +from grades.models import GradingSystem class GradingSystemTestCase(TestCase): -- cgit