Compare commits
No commits in common. "102cc90a23481b641916dd1ff70f291c8c92d63e" and "ece64868fe90e7126308fe03d91adc85a7df7f20" have entirely different histories.
102cc90a23
...
ece64868fe
@ -257,6 +257,8 @@ ASKÖ Ruderverein Donau Linz", self.name, SCHECKBUCH/100),
|
|||||||
mail: &str,
|
mail: &str,
|
||||||
smtp_pw: &str,
|
smtp_pw: &str,
|
||||||
) -> Result<(), String> {
|
) -> Result<(), String> {
|
||||||
|
// 2 things to do:
|
||||||
|
// 1. Send mail to user
|
||||||
Mail::send_single_tx(
|
Mail::send_single_tx(
|
||||||
db,
|
db,
|
||||||
mail,
|
mail,
|
||||||
@ -277,6 +279,20 @@ ASKÖ Ruderverein Donau Linz", self.name),
|
|||||||
smtp_pw,
|
smtp_pw,
|
||||||
).await?;
|
).await?;
|
||||||
|
|
||||||
|
// 2. Notify all coxes
|
||||||
|
let coxes = Role::find_by_name_tx(db, "cox").await.unwrap();
|
||||||
|
Notification::create_for_role_tx(
|
||||||
|
db,
|
||||||
|
&coxes,
|
||||||
|
&format!(
|
||||||
|
"Liebe Steuerberechtigte, {} hat alle Ausfahrten des Scheckbuchs absolviert. Hoffentlich können wir uns bald über ein neues Mitglied freuen :-)",
|
||||||
|
self.name
|
||||||
|
),
|
||||||
|
"Scheckbuch fertig",
|
||||||
|
None,None
|
||||||
|
)
|
||||||
|
.await;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -955,43 +971,14 @@ ORDER BY last_access DESC
|
|||||||
db: &mut Transaction<'_, Sqlite>,
|
db: &mut Transaction<'_, Sqlite>,
|
||||||
smtp_pw: &str,
|
smtp_pw: &str,
|
||||||
) {
|
) {
|
||||||
if self.has_role_tx(db, "scheckbuch").await {
|
if self.has_role_tx(db, "scheckbuch").await
|
||||||
let amount_trips = Logbook::completed_with_user_tx(db, &self).await.len();
|
&& Logbook::completed_with_user_tx(db, &self).await.len() == 5
|
||||||
if amount_trips == 5 {
|
{
|
||||||
if let Some(mail) = &self.mail {
|
if let Some(mail) = &self.mail {
|
||||||
let _ = self.send_end_mail_scheckbuch(db, mail, smtp_pw).await;
|
let _ = self.send_end_mail_scheckbuch(db, mail, smtp_pw).await;
|
||||||
}
|
}
|
||||||
let coxes = Role::find_by_name_tx(db, "cox").await.unwrap();
|
|
||||||
Notification::create_for_role_tx(
|
|
||||||
db,
|
|
||||||
&coxes,
|
|
||||||
&format!(
|
|
||||||
"Liebe Steuerberechtigte, {} hat alle Ausfahrten des Scheckbuchs absolviert. Hoffentlich können wir uns bald über ein neues Mitglied freuen :-)",
|
|
||||||
self.name
|
|
||||||
),
|
|
||||||
"Scheckbuch fertig",
|
|
||||||
None,None
|
|
||||||
)
|
|
||||||
.await;
|
|
||||||
} else if amount_trips > 5 {
|
|
||||||
let board = Role::find_by_name_tx(db, "Vorstand").await.unwrap();
|
|
||||||
Notification::create_for_role_tx(
|
|
||||||
db,
|
|
||||||
&board,
|
|
||||||
&format!(
|
|
||||||
"Lieber Vorstand, {} hat nun bereits die {}. seiner 5 Scheckbuchausfahrten absolviert.",
|
|
||||||
self.name, amount_trips
|
|
||||||
),
|
|
||||||
"Scheckbuch überfertig",
|
|
||||||
None,None
|
|
||||||
)
|
|
||||||
.await;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: check fahrtenabzeichen fertig?
|
|
||||||
// TODO: check äquatorpreis geschafft?
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[async_trait]
|
#[async_trait]
|
||||||
|
Loading…
Reference in New Issue
Block a user