(session: Session,
project: Project,
member: Member,
public_name: str,
action_id: int,
icon: str,
kind: str,
description: str,
trigger_data: dict,
config_data: dict,
template_id: int,
workflow_id: int,
ordinal: int,
archived: bool,
completion_condition_data: dict,
log: dict,
output_interface: dict,
precondition
)
| 114 | |
| 115 | |
| 116 | def action_update_core(session: Session, |
| 117 | project: Project, |
| 118 | member: Member, |
| 119 | public_name: str, |
| 120 | action_id: int, |
| 121 | icon: str, |
| 122 | kind: str, |
| 123 | description: str, |
| 124 | trigger_data: dict, |
| 125 | config_data: dict, |
| 126 | template_id: int, |
| 127 | workflow_id: int, |
| 128 | ordinal: int, |
| 129 | archived: bool, |
| 130 | completion_condition_data: dict, |
| 131 | log: dict, |
| 132 | output_interface: dict, |
| 133 | precondition |
| 134 | ): |
| 135 | workflow = Workflow.get_by_id(session = session, id = workflow_id, project_id = project.id) |
| 136 | if workflow is None: |
| 137 | log['error']['workflow'] = f'Workflow id {workflow_id} not found' |
| 138 | return False, log |
| 139 | |
| 140 | action_template = Action_Template.get_by_id(session = session, id = template_id) |
| 141 | if action_template is None: |
| 142 | log['error']['action_template'] = f'Action template id {template_id} not found' |
| 143 | return False, log |
| 144 | |
| 145 | action = Action.get_by_id(session = session, id = action_id, project_id = project.id) |
| 146 | if action is None: |
| 147 | log['error']['action'] = f'Action {action_id} not found in project {project.project_string_id}' |
| 148 | previous_trigger_data = action.trigger_data.copy() |
| 149 | data_to_update = { |
| 150 | 'public_name': public_name, |
| 151 | 'action_id': action_id, |
| 152 | 'icon': icon, |
| 153 | 'kind': kind, |
| 154 | 'description': description, |
| 155 | 'trigger_data': trigger_data, |
| 156 | 'config_data': config_data, |
| 157 | 'template_id': template_id, |
| 158 | 'workflow_id': workflow_id, |
| 159 | 'ordinal': ordinal, |
| 160 | 'archived': archived, |
| 161 | 'completion_condition_data': completion_condition_data, |
| 162 | 'member_updated_id': member.id, |
| 163 | 'output_interface': output_interface, |
| 164 | 'precondition': precondition |
| 165 | } |
| 166 | for key, val in data_to_update.items(): |
| 167 | setattr(action, key, val) |
| 168 | # Update Scheduler if first action and time schedule set |
| 169 | if trigger_data.get('event_name') == 'time_trigger' and trigger_data.get( |
| 170 | 'cron_expression') and action.workflow.active: |
| 171 | # Send message for batch processing on Rabbit |
| 172 | add_job_scheduling(workflow_id = workflow_id, cron_expression = trigger_data.get('cron_expression')) |
| 173 | if previous_trigger_data.get('event_name') == 'time_trigger' and trigger_data.get('event_name') != 'time_trigger': |
no test coverage detected