Skip to content

Commit 83c093b

Browse files
committed
fix(configuration_steps): Only report deleted parameters if they existed in the file
1 parent 195f227 commit 83c093b

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

ardupilot_methodic_configurator/backend_filesystem.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,11 @@ def calculate_derived_and_forced_param_changes(
926926
)
927927

928928
# Apply deletions from delete_parameters
929-
for param_name in self.compute_deletions(param_filename, step_dict, eval_variables):
929+
to_delete = self.compute_deletions(param_filename, step_dict, eval_variables)
930+
actually_deleted = [p for p in sorted(to_delete) if p in working]
931+
if actually_deleted:
932+
logging_info(_("Deleting parameters %s from '%s'"), actually_deleted, param_filename)
933+
for param_name in to_delete:
930934
working.pop(param_name, None)
931935

932936
# Include in computed_changes if the working copy differs from the loaded in-memory state

ardupilot_methodic_configurator/backend_filesystem_configuration_steps.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -553,8 +553,6 @@ def compute_deletions(self, filename: str, file_info: dict, variables: dict) ->
553553
continue
554554
if self._condition_passes(parameter_info, variables):
555555
to_delete.add(parameter)
556-
if to_delete:
557-
logging_info(_("Deleting parameters %s from '%s'"), sorted(to_delete), filename)
558556
return to_delete
559557

560558
def auto_changed_by(self, selected_file: str) -> str:

ardupilot_methodic_configurator/data_model_parameter_editor.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1774,7 +1774,11 @@ def _repopulate_configuration_step_parameters( # pylint: disable=too-many-local
17741774
# Apply deletions - remove parameters from domain model and track them.
17751775
# Note: compute_deletions is also called in calculate_derived_and_forced_param_changes to
17761776
# update the pre-computed filesystem working copy; this separate call updates the live UI domain model.
1777-
for param_name in self._local_filesystem.compute_deletions(self.current_file, step_info, variables):
1777+
to_delete = self._local_filesystem.compute_deletions(self.current_file, step_info, variables)
1778+
actually_deleted = [p for p in sorted(to_delete) if p in self.current_step_parameters]
1779+
if actually_deleted:
1780+
logging_info(_("Deleting parameters %s from '%s'"), actually_deleted, self.current_file)
1781+
for param_name in to_delete:
17781782
if param_name in self.current_step_parameters:
17791783
self._deleted_parameters.add(param_name)
17801784
del self.current_step_parameters[param_name]

0 commit comments

Comments
 (0)