"""Validate action status.""" from abacus_state.constants.constants import ACTION_STATUSES def are_previous_actions_completed( actions: dict[str, str], action_name: str, ordered_actions: list[str] ) -> bool: """Validate earlier actions are completed or not. Args: actions(list): action states returned by parent_table id action_name(str): name of the action whose status needs to be updated ordered_actions(list): an ordered list of action states for a specified parent table """ current_action_index = ordered_actions.index(action_name) validation_status = all( [ actions.get(action_name) == ACTION_STATUSES.COMPLETE for action_name in ordered_actions[:current_action_index] ] ) return validation_status