From d3a6a99e9c1751ec08bed526d4ce7237425cdf73 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sun, 23 Aug 2020 17:06:24 +0200 Subject: Change start/end times to complete timestamps. The way we had this until now with a date and separate start and end times does not really work. There are cases when a screening starts on one day, but ends on the next. By keeping a complete timestamp for both the start and end times, we don't fall into this problem. --- src/models/screening.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'src/models') diff --git a/src/models/screening.rs b/src/models/screening.rs index b111218..1426605 100644 --- a/src/models/screening.rs +++ b/src/models/screening.rs @@ -28,9 +28,8 @@ joinable!(screenings -> films (film_id)); pub struct NewScreening { pub film_id: i32, pub room_id: i32, - pub date: chrono::NaiveDate, - pub start_time: chrono::NaiveTime, - pub end_time: chrono::NaiveTime, + pub start_time: chrono::DateTime, + pub end_time: chrono::DateTime, } #[derive(Deserialize, Identifiable, PartialEq, Serialize, Queryable)] @@ -39,9 +38,8 @@ pub struct Screening { pub id: i32, pub film_id: i32, pub room_id: i32, - pub date: chrono::NaiveDate, - pub start_time: chrono::NaiveTime, - pub end_time: chrono::NaiveTime, + pub start_time: chrono::DateTime, + pub end_time: chrono::DateTime, } /// Aggregate screening, room and film info into one struct. @@ -50,9 +48,8 @@ pub struct AggregatedScreening { pub id: i32, pub film: Film, pub room: Room, - pub date: chrono::NaiveDate, - pub start_time: chrono::NaiveTime, - pub end_time: chrono::NaiveTime, + pub start_time: chrono::DateTime, + pub end_time: chrono::DateTime, } impl AggregatedScreening { @@ -62,7 +59,6 @@ impl AggregatedScreening { id: s.id, film: f.as_ref().unwrap().clone().to_owned(), room: r.as_ref().unwrap().clone().to_owned(), - date: s.date, start_time: s.start_time, end_time: s.end_time, } -- cgit v1.2.3