def run(instance_id, history_entry_id): session = Session() instance = session.query(Instance).with_for_update().filter_by( id=instance_id).first() history_entry = session.query(History_entry).filter_by( id=history_entry_id).first() state_atual = session.query(WED_state).filter_by( id=instance.state_id).first() state = WED_state( id_cliente=state_atual.id_cliente, cliente='validado1', pontos=state_atual.pontos, id_pedido=state_atual.id_pedido, pedido=state_atual.pedido, id_produto=state_atual.id_produto, produto=state_atual.produto, pagamento=state_atual.pagamento, instance_id=instance.id, ) session.add(state) session.flush() instance.state_id = state.id session.commit() # DESBLOQUEIA o state_atual history_entry.completed_at = datetime.datetime.now() print( "-----------------------------------------------------------------------: ", state_atual.id) history_entry.current_state_id = state_atual.id history_entry.final_state_id = state.id history_entry.status = "success" wed_trigger = session.query(WED_trigger).all() for i in wed_trigger: wedState_wedTrigger(wed_state=state, status='started', wed_trigger=i) session.commit() session.close() print('t_validar_dados acabou..')
def run(instance_id, history_entry_id): session = Session() instance = session.query(Instance).with_for_update().filter_by(id = instance_id).first() history_entry = session.query(History_entry).filter_by(id = history_entry_id).first() state_atual = session.query(WED_state).with_for_update().filter_by(id = instance.state_id).first() state = WED_state( id_cliente = state_atual.id_cliente, cliente = 'validado6', pontos = 10, id_pedido = state_atual.id_pedido, pedido = state_atual.pedido, id_produto = state_atual.id_produto, produto= state_atual.produto, pagamento=state_atual.pagamento, instance_id = instance.id, ) session.add(state) session.flush() instance.state = state session.commit() # DESBLOQUEIA o state_atual history_entry.completed_at = datetime.datetime.now() history_entry.current_state_id = state_atual.id history_entry.final_state_id = state.id history_entry.status = "success" wed_trigger = session.query(WED_trigger).all() for i in wed_trigger: wedState_wedTrigger(wed_state=state, status='started', wed_trigger=i) session.commit() session.close() print('t_atualiza_pfidelidade acabou..')
def coloca_na_fila(self,wedState): wed_trigger = self.select_trigger() for i in wed_trigger: wedState_wedTrigger(wed_state=wedState, status='started', wed_trigger=i)
def coloca_na_fila(self, wedState): wed_trigger = self.select_trigger() for i in wed_trigger: wedState_wedTrigger(wed_state=wedState, status='started', wed_trigger=i)