@@ -104,7 +104,8 @@ def upload_data_to_project(self, data: Any, project_name: str, data_name: str) -
104104 data_name
105105 The name of the child in which data will be stored.
106106 """
107- self .database .upload_data_to_reference_as_child (data , project_name , data_name )
107+ path = "{}/{}" .format (project_name , data_name )
108+ self .database .upload_data (data , path )
108109
109110 def upload_project_data_from_compas (
110111 self ,
@@ -143,7 +144,8 @@ def upload_qr_frames_to_project(self, project_name: str, qr_frames_list: list[Fr
143144 """
144145 qr_assembly = AssemblyExtensions ().create_qr_assembly (qr_frames_list )
145146 data = qr_assembly .__data__
146- self .database .upload_data_to_reference_as_child (data , project_name , "QRFrames" )
147+ path = "{}/{}" .format (project_name , "QRFrames" )
148+ self .database .upload_data (data , path )
147149
148150 def upload_obj_to_storage (self , path_local : str , storage_folder_name : str ) -> None :
149151 """
@@ -156,8 +158,9 @@ def upload_obj_to_storage(self, path_local: str, storage_folder_name: str) -> No
156158 storage_folder_name
157159 The name of the storage folder where the .obj file will be uploaded.
158160 """
159- storage_folder_list = ["obj_storage" , storage_folder_name ]
160- self .storage .upload_file_as_bytes_to_deep_reference (path_local , storage_folder_list )
161+ file_name = os .path .basename (path_local )
162+ storage_path = "obj_storage/{}/{}" .format (storage_folder_name , file_name )
163+ self .storage .upload_file_as_bytes_to_path (path_local , storage_path )
161164
162165 def upload_objs_from_directory_to_storage (self , local_directory : str , storage_folder_name : str ) -> None :
163166 """
@@ -170,8 +173,14 @@ def upload_objs_from_directory_to_storage(self, local_directory: str, storage_fo
170173 storage_folder_name
171174 The name of the storage folder where the .obj files will be uploaded.
172175 """
173- storage_folder_list = ["obj_storage" , storage_folder_name ]
174- self .storage .upload_files_as_bytes_from_directory_to_deep_reference (local_directory , storage_folder_list )
176+ if not os .path .exists (local_directory ) or not os .path .isdir (local_directory ):
177+ raise FileNotFoundError ("Directory not found: {}" .format (local_directory ))
178+
179+ for file_name in os .listdir (local_directory ):
180+ local_path = os .path .join (local_directory , file_name )
181+ if os .path .isfile (local_path ):
182+ storage_path = "obj_storage/{}/{}" .format (storage_folder_name , file_name )
183+ self .storage .upload_file_as_bytes_to_path (local_path , storage_path )
175184
176185 def get_project_data (self , project_name : str ) -> dict :
177186 """
@@ -248,13 +257,13 @@ def edit_step_on_database(
248257 The priority of the step.
249258
250259 """
251- database_reference_list = [ project_name , " building_plan" , " data" , " steps" , key , "data" ]
252- current_data = self .database .get_data_from_deep_reference ( database_reference_list )
260+ database_path = "{}/ building_plan/ data/ steps/{}/data" . format ( project_name , key )
261+ current_data = self .database .get_data ( database_path )
253262 current_data ["actor" ] = actor
254263 current_data ["is_built" ] = is_built
255264 current_data ["is_planned" ] = is_planned
256265 current_data ["priority" ] = priority
257- self .database .upload_data_to_deep_reference (current_data , database_reference_list )
266+ self .database .upload_data (current_data , database_path )
258267
259268 def visualize_project_state_timbers (
260269 self ,
@@ -288,8 +297,8 @@ def visualize_project_state_timbers(
288297
289298 """
290299 nodes = timber_assembly .graph .__data__ ["node" ]
291- buiding_plan_data_reference_list = [ project_name , " building_plan" , " data"]
292- current_state_data = self .database .get_data_from_deep_reference ( buiding_plan_data_reference_list )
300+ building_plan_data_path = "{}/ building_plan/ data". format ( project_name )
301+ current_state_data = self .database .get_data ( building_plan_data_path )
293302
294303 built_human = []
295304 unbuilt_human = []
@@ -364,8 +373,8 @@ def visualize_project_state(self, assembly: Assembly, project_name: str):
364373 The parts that have not been built by a robot.
365374
366375 """
367- buiding_plan_data_reference_list = [ project_name , " building_plan" , " data"]
368- current_state_data = self .database .get_data_from_deep_reference ( buiding_plan_data_reference_list )
376+ building_plan_data_path = "{}/ building_plan/ data". format ( project_name )
377+ current_state_data = self .database .get_data ( building_plan_data_path )
369378 nodes = assembly .graph .__data__ ["node" ]
370379
371380 built_human = []
0 commit comments