Correção no response_time - Calcula quando for contratação.

This commit is contained in:
2026-05-01 00:16:13 -03:00
parent 6ae2e462be
commit b34e5d825a

View File

@@ -316,7 +316,8 @@ fn main() -> anyhow::Result<()> {
.as_str() .as_str()
.expect("Failed to decode message as string"); .expect("Failed to decode message as string");
let found = message.find( let found = message.find(
"Atendimento transferido para a fila [NovaNet -> Atendimento -> Comercial]", //"Atendimento transferido para a fila [NovaNet -> Atendimento -> Comercial]",
"Cliente deseja contratar Plano"
); );
found.is_some() found.is_some()
}); });
@@ -401,14 +402,14 @@ fn main() -> anyhow::Result<()> {
let message = message_object["message"] let message = message_object["message"]
.as_str() .as_str()
.expect("Failed to decode message as string"); .expect("Failed to decode message as string");
let found = message.find("Atendimento entregue da fila de espera para o agente [NOC - "); let found = message.find(
//"Atendimento entregue da fila de espera para o agente [COM - "
"Cliente deseja contratar Plano"
);
found.is_some() found.is_some()
}); });
// Find first agent message sent after the last bot message // Find first agent message sent after the last bot message
// let (pos, transfer_message) =
// bot_transfer_message.expect("Failed to get the transfer bot message position");
let (pos, transfer_message) = match bot_transfer_message { let (pos, transfer_message) = match bot_transfer_message {
Some((pos, msg)) => (pos, msg), Some((pos, msg)) => (pos, msg),
None => return "".to_string(), // Retorna string vazia em vez de panic None => return "".to_string(), // Retorna string vazia em vez de panic
@@ -422,8 +423,7 @@ fn main() -> anyhow::Result<()> {
.rev() .rev()
.filter(|message| { .filter(|message| {
message["type"] == "out".to_string() message["type"] == "out".to_string()
// && message["user"]["name"] != "PipeBot".to_string() && message["user"]["name"].as_str().map_or(false, |name| name.starts_with("COM -"))
&& message["user"]["name"].as_str().map_or(false, |name| name.starts_with("NOC -"))
}) })
.take(1) .take(1)
.collect_vec(); .collect_vec();
@@ -520,7 +520,6 @@ fn main() -> anyhow::Result<()> {
message_object["type"], message_object["type"],
message_object["user"]["name"] message_object["user"]["name"]
); );
// println!("{}", new_json_filtered);
new_json_filtered new_json_filtered
}) })
.reduce(|acc, e| format!("{acc}\n{e}")) .reduce(|acc, e| format!("{acc}\n{e}"))