def get(self, project_id): self.task_type_map = tasks_service.get_task_type_map() self.task_status_map = tasks_service.get_task_status_map() project = projects_service.get_project(project_id) self.check_permissions(project["id"]) csv_content = [] results = self.get_assets_data(project_id) validation_columns = self.get_validation_columns(results) csv_content.append(self.build_headers(validation_columns)) for result in results: result["project_name"] = project["name"] csv_content.append(self.build_row(result, validation_columns)) file_name = "%s assets" % project["name"] return csv_utils.build_csv_response(csv_content, slugify(file_name))
def get(self, playlist_id): playlist = playlists_service.get_playlist(playlist_id) project = projects_service.get_project(playlist["project_id"]) self.check_permissions(project["id"]) self.task_type_map = tasks_service.get_task_type_map() self.task_status_map = tasks_service.get_task_status_map() task_ids = [ shot["preview_file_task_id"] for shot in playlist["shots"] ] self.task_comment_map = tasks_service.get_last_comment_map(task_ids) episode = self.get_episode(playlist) csv_content = [] headers = self.build_headers(playlist, project, episode) csv_content += headers for shot in playlist["shots"]: csv_content.append(self.build_row(shot)) file_name = "%s playlist %s" % (project["name"], playlist["name"]) return csv_utils.build_csv_response(csv_content, slugify(file_name))
def get(self, project_id): project = projects_service.get_project(project_id) self.check_permissions(project["id"]) criterions = query.get_query_criterions_from_request(request) criterions["project_id"] = project["id"] self.task_status_map = tasks_service.get_task_status_map() self.task_type_map = tasks_service.get_task_type_map() csv_content = [] results = self.get_shots_data(criterions) metadata_infos = self.get_metadata_infos(project_id) validation_columns = self.get_validation_columns(results) headers = self.build_headers(metadata_infos, validation_columns) csv_content.append(headers) for result in results: result["project_name"] = project["name"] csv_content.append( self.build_row(result, metadata_infos, validation_columns)) file_name = "%s shots" % project["name"] return csv_utils.build_csv_response(csv_content, slugify(file_name))