also show own trips
This commit is contained in:
parent
af8637d2b7
commit
8666b014f2
@ -19,7 +19,7 @@ pub(crate) async fn get_personal_cal(db: &SqlitePool, user: &User) -> String {
|
|||||||
|
|
||||||
let trips = Trip::all_with_user(db, user).await;
|
let trips = Trip::all_with_user(db, user).await;
|
||||||
for trip in trips {
|
for trip in trips {
|
||||||
calendar.add_event(trip.get_vevent(db).await);
|
calendar.add_event(trip.get_vevent(user).await);
|
||||||
}
|
}
|
||||||
let mut buf = Vec::new();
|
let mut buf = Vec::new();
|
||||||
write!(&mut buf, "{}", calendar).unwrap();
|
write!(&mut buf, "{}", calendar).unwrap();
|
||||||
|
@ -125,7 +125,7 @@ WHERE trip_details.id=?
|
|||||||
.ok()
|
.ok()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) async fn get_vevent(self, db: &SqlitePool) -> ics::Event {
|
pub(crate) async fn get_vevent(self, user: &User) -> ics::Event {
|
||||||
let mut vevent = ics::Event::new(format!("{}@rudernlinz.at", self.id), "19900101T180000");
|
let mut vevent = ics::Event::new(format!("{}@rudernlinz.at", self.id), "19900101T180000");
|
||||||
vevent.push(DtStart::new(format!(
|
vevent.push(DtStart::new(format!(
|
||||||
"{}T{}00",
|
"{}T{}00",
|
||||||
@ -143,7 +143,11 @@ WHERE trip_details.id=?
|
|||||||
|
|
||||||
name.push_str("! :-( ");
|
name.push_str("! :-( ");
|
||||||
}
|
}
|
||||||
|
if self.cox_id == user.id {
|
||||||
|
name.push_str("Ruderausfahrt (selber ausgeschrieben)");
|
||||||
|
} else {
|
||||||
name.push_str(&format!("Ruderausfahrt mit {} ", self.cox_name));
|
name.push_str(&format!("Ruderausfahrt mit {} ", self.cox_name));
|
||||||
|
}
|
||||||
|
|
||||||
vevent.push(Summary::new(name));
|
vevent.push(Summary::new(name));
|
||||||
vevent
|
vevent
|
||||||
@ -168,6 +172,9 @@ INNER JOIN user ON trip.cox_id = user.id
|
|||||||
let mut ret = Vec::new();
|
let mut ret = Vec::new();
|
||||||
let trips = Self::all(db).await;
|
let trips = Self::all(db).await;
|
||||||
for trip in trips {
|
for trip in trips {
|
||||||
|
if user.id == trip.cox_id {
|
||||||
|
ret.push(trip.clone());
|
||||||
|
}
|
||||||
if let Some(trip_details_id) = trip.trip_details_id {
|
if let Some(trip_details_id) = trip.trip_details_id {
|
||||||
if UserTrip::find_by_userid_and_trip_detail_id(db, user.id, trip_details_id)
|
if UserTrip::find_by_userid_and_trip_detail_id(db, user.id, trip_details_id)
|
||||||
.await
|
.await
|
||||||
|
Loading…
Reference in New Issue
Block a user