def import_row(self, row, project_id): asset_key = slugify("%s%s" % (row["Asset Type"], row["Asset"])) if row["Episode"] == "MP": row["Episode"] = "" target_key = slugify( "%s%s%s" % (row["Episode"], row["Parent"], row["Name"]) ) occurences = 1 if len(row["Occurences"]) > 0: occurences = int(row["Occurences"]) asset_id = self.asset_map.get(asset_key, None) target_id = self.shot_map.get(target_key, None) label = slugify(row.get("Label", "fixed")) if target_id is None: target_id = self.asset_map.get(target_key, None) if asset_id is not None and target_id is not None: link = breakdown_service.get_entity_link_raw(target_id, asset_id) if link is None: breakdown_service.create_casting_link( target_id, asset_id, occurences, label ) else: link.update({ "nb_occurences": occurences, "label": label })
def test_remove_shot(self): shot_id = str(self.shot.id) asset_id = str(self.asset.id) breakdown_service.create_casting_link(shot_id, asset_id) shots_service.remove_shot(shot_id) with pytest.raises(ShotNotFoundException): shots_service.get_shot(shot_id)
def test_delete_project(self): self.generate_fixture_asset_type() self.generate_fixture_asset_types() self.generate_assigned_task() self.generate_fixture_episode() self.generate_fixture_sequence() self.generate_fixture_shot() breakdown_service.create_casting_link(self.shot.id, self.asset.id) project_id = str(self.project.id) deletion_service.remove_project(project_id) self.assertIsNone(Project.get(project_id))
def import_row(self, row, project_id): asset_key = slugify("%s%s" % (row["Asset Type"], row["Asset"])) target_key = slugify("%s%s%s" % (row["Episode"], row["Parent"], row["Name"])) occurences = 1 if len(row["Occurences"]) > 0: occurences = int(row["Occurences"]) label = slugify(row["Label"]) asset_id = self.asset_map.get(asset_key, None) target_id = self.shot_map.get(target_key, None) if target_id is None: target_id = self.asset_map.get(target_key, None) if asset_id is not None and target_id is not None: breakdown_service.create_casting_link(target_id, asset_id, occurences, label)
def import_row(self, row, project_id): asset_key = slugify("%s%s" % (row["Asset Type"], row["Asset"])) if row.get("Episode") == "MP": row["Episode"] = "" target_key = slugify( "%s%s%s" % (row.get("Episode", ""), row["Parent"], row["Name"]) ) occurences = 1 if len(row["Occurences"]) > 0: occurences = int(row["Occurences"]) asset_id = self.asset_map.get(asset_key, None) target_id = self.shot_map.get(target_key, None) label = slugify(row.get("Label", "fixed")) if target_id is None: target_id = self.asset_map.get(target_key, None) if asset_id is not None and target_id is not None: entity = entities_service.get_entity_raw(target_id) link = breakdown_service.get_entity_link_raw(target_id, asset_id) if link is None: breakdown_service.create_casting_link( target_id, asset_id, occurences, label ) entity.update({"nb_entities_out": entity.nb_entities_out + 1}) else: link.update({"nb_occurences": occurences, "label": label}) entity_id = str(entity.id) if shots_service.is_shot(entity.serialize()): breakdown_service.refresh_shot_casting_stats( entity.serialize() ) events.emit( "shot:casting-update", { "shot_id": entity_id, "nb_entities_out": entity.nb_entities_out, }, project_id=str(entity.project_id), ) else: events.emit( "asset:casting-update", {"asset_id": entity_id}, project_id=str(entity.project_id), )
def setUp(self): super(ProjectSyncRouteTestCase, self).setUp() self.generate_shot_suite() self.generate_assigned_task() self.generate_fixture_shot_task() self.project_id = str(self.project.id) self.task_type_id = str(self.task_type.id) self.task_type_animation_id = str(self.task_type_animation.id) self.sequence_id = str(self.sequence.id) self.episode_id = str(self.episode.id) self.asset_type_id = str(self.asset_type.id) self.generate_fixture_subscription() self.generate_fixture_comment() self.generate_fixture_notification() self.generate_fixture_preview_file() self.generate_fixture_playlist("test") self.generate_fixture_build_job("2019-08-01T12:00:00") self.generate_fixture_milestone() breakdown_service.create_casting_link(self.shot.id, self.asset.id) self.generate_fixture_project_standard() self.generate_fixture_asset_standard() self.generate_fixture_task_standard() self.generate_fixture_sequence_standard() self.generate_fixture_shot_standard() self.task = self.task_standard self.project = self.project_standard self.generate_fixture_comment() self.generate_fixture_notification() self.generate_fixture_subscription() self.generate_fixture_preview_file() self.generate_fixture_playlist("test 2") self.generate_fixture_build_job("2019-08-01T13:00:00") self.generate_fixture_milestone() breakdown_service.create_casting_link(self.shot_standard.id, self.asset_standard.id)