Example #1
0
 def get(self, person_id, year, month, day):
     user_service.check_person_access(person_id)
     try:
         return time_spents_service.get_day_time_spents(
             person_id, year, month, day)
     except WrongDateFormatException:
         abort(404)
Example #2
0
 def get(self, person_id, year, month, day):
     permissions.check_admin_permissions()
     try:
         return time_spents_service.get_day_time_spents(
             person_id, year, month, day)
     except WrongDateFormatException:
         abort(404)
Example #3
0
 def test_get_day_time_spents(self):
     with app.app_context():
         tasks = time_spents_service.get_day_time_spents(
             self.person_id, "2018", "5", "3")
         self.assertEqual(len(tasks), 1)
         self.assertEqual(tasks[0]["entity_name"], "Tree")
         self.assertEqual(tasks[0]["duration"], 600)
Example #4
0
 def get(self, person_id, year, month, day):
     """
     Get aggregated time spents for given person and day.
     ---
     tags:
     - Persons
     parameters:
       - in: path
         name: person_id
         required: True
         schema:
             type: UUID
             example: a24a6ea4-ce75-4665-a070-57453082c25
       - in: path
         name: year
         required: True
         schema:
             type: integer
             example: 2022
       - in: path
         name: month
         required: True
         schema:
             type: integer
             example: 07 (from 01 to 12)
       - in: path
         name: day
         required: True
         schema:
             type: integer
             example: 12 (from 01 to 31)
     responses:
         200:
             description: Aggregated time spents for given person and day
         404:
             description: Wrong date format
     """
     project_id = self.get_project_id()
     user_service.check_person_access(person_id)
     try:
         return time_spents_service.get_day_time_spents(
             person_id, year, month, day, project_id=project_id
         )
     except WrongDateFormatException:
         abort(404)