From 478ce329e39a7a61faa447b3fdb946c391ff83e0 Mon Sep 17 00:00:00 2001 From: philipp Date: Wed, 24 May 2023 13:11:47 +0200 Subject: [PATCH] Push --- src/model/trip.rs | 7 +++---- src/rest/mod.rs | 5 ++++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/model/trip.rs b/src/model/trip.rs index e60f77a..92895e4 100644 --- a/src/model/trip.rs +++ b/src/model/trip.rs @@ -34,14 +34,13 @@ pub struct TripWithUserAndType { impl Trip { /// Cox decides to create own trip. pub async fn new_own(db: &SqlitePool, cox: &CoxUser, trip_details: TripDetails) { - sqlx::query!( + let _ = sqlx::query!( "INSERT INTO trip (cox_id, trip_details_id) VALUES(?, ?)", cox.id, trip_details.id ) .execute(db) - .await - .unwrap(); //Okay, bc. CoxUser + TripDetails can only be created with proper DB backing + .await; } pub async fn find_by_id(db: &SqlitePool, id: i64) -> Option { @@ -99,7 +98,7 @@ WHERE day=? ) .fetch_all(db) .await - .unwrap(); //TODO: fixme + .unwrap(); //Okay, as Trip can only be created with proper DB backing let mut ret = Vec::new(); for trip in trips { diff --git a/src/rest/mod.rs b/src/rest/mod.rs index 1131fac..794c6e2 100644 --- a/src/rest/mod.rs +++ b/src/rest/mod.rs @@ -26,7 +26,10 @@ mod faq; fn amount_days_to_show(is_cox: bool) -> i64 { if is_cox { - let end_of_year = NaiveDate::from_ymd_opt(Local::now().year(), 12, 31).unwrap(); + let end_of_year = NaiveDate::from_ymd_opt(Local::now().year(), 12, 31).unwrap(); //Ok, + //december + //has 31 + //days end_of_year .signed_duration_since(Local::now().date_naive()) .num_days()