예제 #1
0
 def get(self, person_id, year, week):
     user_service.check_person_access(person_id)
     try:
         return time_spents_service.get_week_time_spents(
             person_id, year, week)
     except WrongDateFormatException:
         abort(404)
예제 #2
0
파일: resources.py 프로젝트: withgame/zou
 def get(self, person_id, year, week):
     permissions.check_admin_permissions()
     try:
         return time_spents_service.get_week_time_spents(
             person_id, year, week)
     except WrongDateFormatException:
         abort(404)
예제 #3
0
 def test_get_week_time_spents(self):
     with app.app_context():
         tasks = time_spents_service.get_week_time_spents(
             self.person_id, "2018", "18")
         self.assertEqual(len(tasks), 1)
         self.assertEqual(tasks[0]["entity_name"], "Tree")
         self.assertEqual(tasks[0]["duration"], 600)
예제 #4
0
 def get(self, person_id, year, week):
     """
     Get aggregated time spents for given person and week.
     ---
     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: week
         required: True
         schema:
             type: integer
             example: 35 (from 01 to 52)
     responses:
         200:
             description: Aggregated time spents for given person and week
         404:
             description: Wrong date format
     """
     project_id = self.get_project_id()
     user_service.check_person_access(person_id)
     try:
         return time_spents_service.get_week_time_spents(
             person_id, year, week, project_id=project_id
         )
     except WrongDateFormatException:
         abort(404)
예제 #5
0
 def test_get_week_time_spents_first_week_of_the_year(self):
     tasks = time_spents_service.get_week_time_spents(
         self.person_id, "2019", "1")
     self.assertEqual(len(tasks), 1)
     self.assertEqual(tasks[0]["duration"], 850)