def append_plans(self, report):
     """
 Добавить плановое по к-во вопросов в отчет
 """
     plans = PlanCtrl.get_on_month(self.year, self.month)
     for r in report:
         plan = find(plans, lambda p: p.employee.name == r['employee_name'])
         if plan is not None:
             r['qty_plan'] = plan.qty_question
     return report
예제 #2
0
 def test_get_on_month_NOT_create(self):
     # Планы НЕ создаются
     plans = PlanCtrl.get_on_month(2017, 12)
     self.assertEqual(len(plans), 1)
예제 #3
0
 def test_get_on_month_create(self):
     # Планы создаются, если не созданы
     plans = PlanCtrl.get_on_month(3000, 12)
     self.assertEqual(len(plans), 2)
예제 #4
0
 def get(self):
     """
 Получение планов на год/месяц
 """
     plans = PlanCtrl.get_on_month(self.context.year, self.context.month)
     return self.serializator.dump(plans, many=True).data