clean /log by only showing boat reservation for the next 3 days
This commit is contained in:
@@ -95,13 +95,13 @@ WHERE end_date >= ? AND start_date <= ?
|
||||
res
|
||||
}
|
||||
|
||||
pub async fn all_future(db: &SqlitePool) -> Vec<BoatReservationWithDetails> {
|
||||
pub async fn next_future(db: &SqlitePool) -> Vec<BoatReservationWithDetails> {
|
||||
let boatreservations = sqlx::query_as!(
|
||||
Self,
|
||||
"
|
||||
SELECT id, boat_id, start_date, end_date, time_desc, usage, user_id_applicant, user_id_confirmation, created_at
|
||||
FROM boat_reservation
|
||||
WHERE end_date >= CURRENT_DATE ORDER BY end_date
|
||||
WHERE end_date >= CURRENT_DATE AND end_date <= date(CURRENT_DATE, '+3 days') ORDER BY end_date
|
||||
"
|
||||
)
|
||||
.fetch_all(db)
|
||||
@@ -158,10 +158,10 @@ WHERE end_date >= CURRENT_DATE ORDER BY end_date
|
||||
|
||||
grouped_reservations
|
||||
}
|
||||
pub async fn all_future_with_groups(
|
||||
pub async fn next_future_with_groups(
|
||||
db: &SqlitePool,
|
||||
) -> HashMap<String, Vec<BoatReservationWithDetails>> {
|
||||
let reservations = Self::all_future(db).await;
|
||||
let reservations = Self::next_future(db).await;
|
||||
Self::with_groups(reservations)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user