cox always see full year

This commit is contained in:
philipp 2023-04-04 15:42:26 +02:00
parent 476c4db255
commit 21b87f9471
2 changed files with 3 additions and 12 deletions

View File

@ -14,17 +14,12 @@ mod admin;
mod auth; mod auth;
mod cox; mod cox;
#[get("/?<all>")] #[get("/")]
async fn index( async fn index(db: &State<SqlitePool>, user: User, flash: Option<FlashMessage<'_>>) -> Template {
db: &State<SqlitePool>,
user: User,
flash: Option<FlashMessage<'_>>,
all: Option<String>,
) -> Template {
let mut days = Vec::new(); let mut days = Vec::new();
let mut show_next_n_days = 6; let mut show_next_n_days = 6;
if all.is_some() && user.is_cox { if user.is_cox {
let end_of_year = NaiveDate::from_ymd_opt(Local::now().year(), 12, 31).unwrap(); let end_of_year = NaiveDate::from_ymd_opt(Local::now().year(), 12, 31).unwrap();
show_next_n_days = end_of_year show_next_n_days = end_of_year
.signed_duration_since(Local::now().date_naive()) .signed_duration_since(Local::now().date_naive())

View File

@ -2,10 +2,6 @@
{% block content %} {% block content %}
{% if loggedin_user.is_cox %}
<a href="/?all">SHOW FULL YEAR</a>
{% endif %}
{% if loggedin_user %} {% if loggedin_user %}
Hi {{ loggedin_user.name }}. <a href="/auth/logout">LOGOUT</a> Hi {{ loggedin_user.name }}. <a href="/auth/logout">LOGOUT</a>