- # pylint: disable=too-many-branches
- id_ = self._params.get_int_or_none('id')
- for _ in self._form_data.get_all_str('delete'):
- if id_ is None:
- raise NotFoundException('trying to delete non-saved Process')
- process = Process.by_id(self.conn, id_)
- process.remove(self.conn)
- return '/processes'
- process = Process.by_id_or_create(self.conn, id_)
- process.title.set(self._form_data.get_str('title'))
- process.description.set(self._form_data.get_str('description'))
- process.effort.set(self._form_data.get_float('effort'))
- process.set_conditions(self.conn,
- self._form_data.get_all_int('condition'))
- process.set_blockers(self.conn, self._form_data.get_all_int('blocker'))
- process.set_enables(self.conn, self._form_data.get_all_int('enables'))
- process.set_disables(self.conn,
- self._form_data.get_all_int('disables'))
- process.calendarize = self._form_data.get_all_str('calendarize') != []
+ # pylint: disable=too-many-locals
+ # pylint: disable=too-many-statements
+ title = self._form_data.get_str('title')
+ description = self._form_data.get_str('description')
+ effort = self._form_data.get_float('effort')
+ conditions = self._form_data.get_all_int('conditions')
+ blockers = self._form_data.get_all_int('blockers')
+ enables = self._form_data.get_all_int('enables')
+ disables = self._form_data.get_all_int('disables')
+ calendarize = self._form_data.get_all_str('calendarize') != []
+ suppresses = self._form_data.get_all_int('suppresses')
+ step_of = self._form_data.get_all_str('step_of')
+ keep_steps = self._form_data.get_all_int('keep_step')
+ step_ids = self._form_data.get_all_int('steps')
+ new_top_steps = self._form_data.get_all_str('new_top_step')
+ step_process_id_to = {}
+ step_parent_id_to = {}
+ new_steps_to = {}
+ for step_id in step_ids:
+ name = f'new_step_to_{step_id}'
+ new_steps_to[step_id] = self._form_data.get_all_int(name)
+ for step_id in keep_steps:
+ name = f'step_{step_id}_process_id'
+ step_process_id_to[step_id] = self._form_data.get_int(name)
+ name = f'step_{step_id}_parent_id'
+ step_parent_id_to[step_id] = self._form_data.get_int_or_none(name)
+ process.title.set(title)
+ process.description.set(description)
+ process.effort.set(effort)
+ process.set_conditions(self.conn, conditions)
+ process.set_blockers(self.conn, blockers)
+ process.set_enables(self.conn, enables)
+ process.set_disables(self.conn, disables)
+ process.calendarize = calendarize