calendarize = self._form_data.get_bool('calendarize')
step_of = self._form_data.get_all_str('step_of')
suppresses = self._form_data.get_all_int('suppresses')
- step_ids = self._form_data.get_all_int('kept_steps')
+ kept_steps = self._form_data.get_all_int('kept_steps')
new_top_steps = self._form_data.get_all_str('new_top_step')
new_steps_to = {}
- for step_id in step_ids:
+ for step_id in kept_steps:
name = f'new_step_to_{step_id}'
new_steps_to[step_id] = self._form_data.get_all_int(name)
for k, v in versioned.items():
process.save(self.conn)
assert isinstance(process.id_, int)
# set relations to, and if non-existant yet: create, other Processes
+ # pylint: disable=fixme
+ # TODO: in what order to set owners, owneds, and possibly step
+ # suppressions can make the difference between recursion checks
+ # failing; should probably be handled class-internally to Process
+ # rather than here!
# 1. owners (upwards)
owners_to_set = []
new_owner_title = None
# 2. owneds (downwards)
new_step_title = None
steps: list[ProcessStep] = [ProcessStep.by_id(self.conn, step_id)
- for step_id in step_ids]
- for step_id in step_ids:
- new = [ProcessStep(None, process.id_, step_process_id, step_id)
- for step_process_id in new_steps_to[step_id]]
- steps += new
- for step_identifier in new_top_steps:
+ for step_id in kept_steps]
+ for step_id in kept_steps:
+ new_sub_steps = [
+ ProcessStep(None, process.id_, step_process_id, step_id)
+ for step_process_id in new_steps_to[step_id]]
+ steps += new_sub_steps
+ for step_id_or_new_title in new_top_steps:
try:
- step_process_id = int(step_identifier)
+ step_process_id = int(step_id_or_new_title)
step = ProcessStep(None, process.id_, step_process_id, None)
steps += [step]
except ValueError:
- new_step_title = step_identifier
+ new_step_title = step_id_or_new_title
process.set_steps(self.conn, steps)
process.set_step_suppressions(self.conn, suppresses)
# encode titles for potentially newly created Processes up or down