|
|
|
@ -7,6 +7,7 @@ use std::sync::Mutex;
|
|
|
|
|
use rocket::{State, response::content}; |
|
|
|
|
use typed_html::{html, text, dom::DOMTree}; |
|
|
|
|
use diesel::{Connection, pg::PgConnection, prelude::*}; |
|
|
|
|
use chrono::offset::Local; |
|
|
|
|
|
|
|
|
|
use libticker::{ |
|
|
|
|
config::{Config, CalendarOptions}, |
|
|
|
@ -26,7 +27,9 @@ fn fix_url(s: &str) -> std::borrow::Cow<str> {
|
|
|
|
|
#[get("/")] |
|
|
|
|
fn index(db: State<Mutex<PgConnection>>) -> content::Html<String> { |
|
|
|
|
let db = db.lock().unwrap(); |
|
|
|
|
let today = Local::today().naive_local().and_hms(0, 0, 0); |
|
|
|
|
let es = events |
|
|
|
|
.filter(schema::events::dtstart.ge(&today)) |
|
|
|
|
.order_by(schema::events::dtstart.asc()) |
|
|
|
|
.then_order_by(schema::events::dtend.desc()) |
|
|
|
|
.load::<Event>(&*db) |
|
|
|
|