chore: calculate excelence percentual for chats
This commit is contained in:
@@ -262,6 +262,17 @@ fn main() {
|
||||
.get(5)
|
||||
.expect("Failed to get the id from regex maches");
|
||||
|
||||
let excelence_percentual = columns
|
||||
.iter()
|
||||
.map(|col| col.as_materialized_series().u32().unwrap().sum().unwrap())
|
||||
.sum::<u32>() as f32
|
||||
/ columns.iter().len() as f32
|
||||
* 100.0;
|
||||
columns.push(Column::new(
|
||||
"PERCENTUAL DE EXELENCIA".into(),
|
||||
[format!("{excelence_percentual:.2}")],
|
||||
));
|
||||
|
||||
columns.push(Column::new("ID_TALK".into(), [talk_id.clone().as_str()]));
|
||||
|
||||
let df = polars::frame::DataFrame::new(columns)
|
||||
@@ -369,13 +380,13 @@ fn main() {
|
||||
|
||||
let recipients = "Wilson da Conceição Oliveira <wilson.oliveira@nova.net.br>, Isadora G. Moura de Moura <isadora.moura@nova.net.br>";
|
||||
println!("Trying to send mail... {recipients}");
|
||||
send_mail_util::send_mail_util::send_email(
|
||||
&format!(
|
||||
"Relatório agrupado dos atendimentos semana {first_day_of_last_week} - {last_day_of_last_week}"
|
||||
),
|
||||
&BOT_EMAIL,
|
||||
&BOT_EMAIL_PASSWORD,
|
||||
recipients,
|
||||
&format!("./groupped/{first_day_of_last_week} - {last_day_of_last_week}.zip"),
|
||||
);
|
||||
// send_mail_util::send_mail_util::send_email(
|
||||
// &format!(
|
||||
// "Relatório agrupado dos atendimentos semana {first_day_of_last_week} - {last_day_of_last_week}"
|
||||
// ),
|
||||
// &BOT_EMAIL,
|
||||
// &BOT_EMAIL_PASSWORD,
|
||||
// recipients,
|
||||
// &format!("./groupped/{first_day_of_last_week} - {last_day_of_last_week}.zip"),
|
||||
// );
|
||||
}
|
||||
|
||||
10
src/main.rs
10
src/main.rs
@@ -10,8 +10,8 @@ use serde_json::{self, json};
|
||||
|
||||
use std::io::prelude::*;
|
||||
|
||||
pub mod zip_directory_util;
|
||||
pub mod send_mail_util;
|
||||
pub mod zip_directory_util;
|
||||
|
||||
fn main() -> anyhow::Result<()> {
|
||||
match dotenv::dotenv().ok() {
|
||||
@@ -529,7 +529,13 @@ fn main() -> anyhow::Result<()> {
|
||||
let recipients = "Wilson da Conceição Oliveira <wilson.oliveira@nova.net.br>, Isadora G. Moura de Moura <isadora.moura@nova.net.br>";
|
||||
println!("Trying to send email... Recipients {recipients}");
|
||||
|
||||
send_mail_util::send_mail_util::send_email(&format!("Avaliacao atendimentos {formatted_day_before}"), &BOT_EMAIL, &BOT_EMAIL_PASSWORD, recipients, &output_zip_file_str);
|
||||
send_mail_util::send_mail_util::send_email(
|
||||
&format!("Avaliacao atendimentos {formatted_day_before}"),
|
||||
&BOT_EMAIL,
|
||||
&BOT_EMAIL_PASSWORD,
|
||||
recipients,
|
||||
&output_zip_file_str,
|
||||
);
|
||||
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
@@ -66,5 +66,4 @@ pub fn zip_source_dir_to_dst_file(src_dir: &Path, dst_file: &Path) {
|
||||
|
||||
zip_dir(&mut it.filter_map(|e| e.ok()), src_dir, file, method);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user