Beispiel #1
0
 def run_import(self, project_id, file_path):
     entities = super().run_import(project_id, file_path)
     for asset in entities:
         task_type_ids = self.get_task_types_for_asset_type(
             asset["entity_type_id"])
         for task_type_id in task_type_ids:
             tasks_service.create_tasks({"id": task_type_id}, [asset])
     return entities
Beispiel #2
0
 def run_import(self, project_id, file_path):
     entities = super().run_import(project_id, file_path)
     task_types_in_project_for_shots = TaskType.query.join(
         ProjectTaskTypeLink).filter(
             ProjectTaskTypeLink.project_id == project_id).filter(
                 TaskType.for_shots == True)
     for task_type in task_types_in_project_for_shots:
         create_tasks(task_type.serialize(), self.created_shots)
     return entities
Beispiel #3
0
 def test_create_tasks(self):
     shot = self.shot.serialize()
     shot_2 = self.generate_fixture_shot("S02").serialize()
     task_type = self.task_type.serialize()
     status = tasks_service.get_todo_status()
     tasks = tasks_service.create_tasks(task_type, [shot, shot_2])
     self.assertEqual(len(tasks), 2)
     task = tasks[0]
     task = tasks_service.get_task(task["id"])
     self.assertEqual(task["entity_id"], shot["id"])
     self.assertEqual(task["task_type_id"], task_type["id"])
     self.assertEqual(task["project_id"], shot["project_id"])
     self.assertEqual(task["task_status_id"], status["id"])
Beispiel #4
0
    def post(self, project_id, task_type_id):
        user_service.check_manager_project_access(project_id)
        task_type = tasks_service.get_task_type(task_type_id)

        asset_ids = request.json
        assets = []
        if type(asset_ids) == list and len(asset_ids) > 0:
            for asset_id in asset_ids:
                asset = assets_service.get_asset(asset_id)
                if asset["project_id"] == project_id:
                    assets.append(asset)
        else:
            criterions = query.get_query_criterions_from_request(request)
            criterions["project_id"] = project_id
            assets = assets_service.get_assets(criterions)

        tasks = tasks_service.create_tasks(task_type, assets)
        return tasks, 201
Beispiel #5
0
    def post(self, project_id, task_type_id):
        user_service.check_manager_project_access(project_id)
        task_type = tasks_service.get_task_type(task_type_id)

        shot_ids = request.json
        shots = []
        if type(shot_ids) == list and len(shot_ids) > 0:
            for shot_id in shot_ids:
                shot = shots_service.get_shot(shot_id)
                if shot["project_id"] == project_id:
                    shots.append(shot)
        else:
            criterions = query.get_query_criterions_from_request(request)
            criterions["project_id"] = project_id
            shots = shots_service.get_shots(criterions)

        task_type = tasks_service.get_task_type(task_type_id)
        tasks = tasks_service.create_tasks(task_type, shots)
        return tasks, 201
Beispiel #6
0
    def post(self, project_id, task_type_id):
        """
        Create a new task for given shot and task type.
        ---
        tags:
        - Tasks
        parameters:
          - in: path
            name: project_id
            required: True
            schema:
                type: UUID
                example: a24a6ea4-ce75-4665-a070-57453082c25
          - in: path
            name: task_type_id
            required: True
            schema:
                type: UUID
                example: a24a6ea4-ce75-4665-a070-57453082c25
        responses:
            201:
                description: New task for given shot and task type created
        """
        user_service.check_manager_project_access(project_id)
        task_type = tasks_service.get_task_type(task_type_id)

        shot_ids = request.json
        shots = []
        if type(shot_ids) == list and len(shot_ids) > 0:
            for shot_id in shot_ids:
                shot = shots_service.get_shot(shot_id)
                if shot["project_id"] == project_id:
                    shots.append(shot)
        else:
            criterions = query.get_query_criterions_from_request(request)
            criterions["project_id"] = project_id
            shots = shots_service.get_shots(criterions)

        task_type = tasks_service.get_task_type(task_type_id)
        tasks = tasks_service.create_tasks(task_type, shots)
        return tasks, 201
Beispiel #7
0
 def run_import(self, project_id, file_path):
     entities = super().run_import(project_id, file_path)
     for task_type in self.task_types_in_project_for_shots:
         create_tasks(task_type.serialize(), self.created_shots)
     return entities