Cargo update

This commit is contained in:
Manuel Vögele
2024-01-10 17:34:23 +01:00
parent 9b0876cb08
commit cd2598a571
3 changed files with 647 additions and 544 deletions

1177
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
use chrono::{DateTime, NaiveDateTime, TimeZone, Utc}; use chrono::{DateTime, TimeZone, Utc};
use diesel::Queryable; use diesel::Queryable;
use crate::appointment::Appointment; use crate::appointment::Appointment;
@@ -31,18 +31,13 @@ impl From<DbChat> for ChatInfo<Utc> {
// Join appointments into single option // Join appointments into single option
.and_then(|start| Some([start, db_chat.next_appointment_end?])) .and_then(|start| Some([start, db_chat.next_appointment_end?]))
// Convert timestamps to datetimes // Convert timestamps to datetimes
.map(|timestamps| { .map(|timestamps| timestamps.map(|timestamp| Utc.timestamp_opt(timestamp, 0).unwrap()))
timestamps
.map(|timestamp| NaiveDateTime::from_timestamp_opt(timestamp, 0).unwrap())
.map(|date_time| DateTime::<Utc>::from_utc(date_time, Utc))
})
// Join datetimes into Appointment // Join datetimes into Appointment
.map(|[start, end]| Appointment { start, end }); .map(|[start, end]| Appointment { start, end });
let last_reminder = db_chat let last_reminder = db_chat
.last_reminder .last_reminder
.map(|timestamp| NaiveDateTime::from_timestamp_opt(timestamp, 0).unwrap()) .map(|timestamp| Utc.timestamp_opt(timestamp, 0).unwrap());
.map(|date_time| DateTime::<Utc>::from_utc(date_time, Utc));
let locale = db_chat.locale.unwrap_or("de".into()); let locale = db_chat.locale.unwrap_or("de".into());

View File

@@ -105,8 +105,7 @@ async fn main() {
}; };
let sleep_duration = next_appointment let sleep_duration = next_appointment
.map(|timestamp| NaiveDateTime::from_timestamp_opt(timestamp, 0).unwrap()) .map(|timestamp| Utc.timestamp_opt(timestamp, 0).unwrap())
.map(|naive_date_time| DateTime::<Utc>::from_utc(naive_date_time, Utc))
.map(|date_time| date_time - now) .map(|date_time| date_time - now)
.map(|duration| duration.to_std().unwrap()) .map(|duration| duration.to_std().unwrap())
.filter(|duration| *duration < poll_duration) .filter(|duration| *duration < poll_duration)