From dcfe66e4d409a2b89b93be2ead8a7a84ab863dc0 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sat, 10 Aug 2019 17:37:08 +0200 Subject: Rename Screening model to AggregateScreening --- src/models/screening.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/models') diff --git a/src/models/screening.rs b/src/models/screening.rs index 4ae42a2..feb98cc 100644 --- a/src/models/screening.rs +++ b/src/models/screening.rs @@ -44,8 +44,9 @@ pub struct ScreeningRecord { pub end_time: chrono::NaiveTime, } +/// Aggregate screening, room and film info into one struct. #[derive(Deserialize, Serialize)] -pub struct Screening { +pub struct AggregatedScreening { pub id: i32, pub film: Film, pub room: Room, @@ -54,10 +55,10 @@ pub struct Screening { pub end_time: chrono::NaiveTime, } -impl Screening { - pub fn from_query(s: Vec<(ScreeningRecord, Option, Option)>) -> Vec { +impl AggregatedScreening { + pub fn from_query(s: Vec<(ScreeningRecord, Option, Option)>) -> Vec { s.iter().map(|(s, f, r)| { - Screening { + AggregatedScreening { id: s.id, film: f.as_ref().unwrap().clone().to_owned(), room: r.as_ref().unwrap().clone().to_owned(), -- cgit v1.2.3