feat: add earned points calculator
This commit is contained in:
1 parent
8e4f461e8b
commit
9e3b50c967
7 files changed
+160
-5
No files matched your search
@@ -44,6 +44,20 @@ class ApiTests(unittest.TestCase):
|
||||
self.assertEqual(response["result"]["total_hours"], 2)
|
||||
self.assertIn("Осталось добрать: 24", response["message"])
|
||||
|
||||
def test_points_calculator_returns_separate_coach_and_kittens(self):
|
||||
response = calculate_payload({
|
||||
"mode": "points", "activity": "coaching", "skill": "ЛУ", "start": "11:00", "end": "11:20",
|
||||
"kitten_statuses": ["самостоятельно", "несамостоятельно"],
|
||||
})
|
||||
self.assertEqual(response["result"], {"minutes": 20, "curator_points": 8, "kitten_points": [4, 4]})
|
||||
|
||||
def test_points_calculator_supports_training_and_inspection(self):
|
||||
self.assertEqual(calculate_payload({"mode": "points", "activity": "training"})["result"]["kitten_points"], 25)
|
||||
self.assertEqual(calculate_payload({
|
||||
"mode": "points", "activity": "inspection", "place": "дупло", "inspections": 2,
|
||||
"resources": [["паук", 1]],
|
||||
})["result"]["points"], 5)
|
||||
|
||||
def test_goal_calculator_rejects_non_finite_json_number(self):
|
||||
with self.assertRaisesRegex(ApiError, "конечным числом"):
|
||||
calculate_payload({
|
||||
|
||||
Reference in new issue
Block a user