Compare commits

...

2 Commits

Author SHA1 Message Date
01fdfcae99 Merge pull request 'show second button in winter' (#775) from update-ergo into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 12m29s
CI/CD Pipeline / deploy-staging (push) Successful in 10m38s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #775
2024-10-19 22:17:21 +02:00
f801606899 show second button in winter
All checks were successful
CI/CD Pipeline / test (push) Successful in 12m34s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped
2024-10-19 22:16:28 +02:00
2 changed files with 15 additions and 1 deletions

View File

@ -1,6 +1,6 @@
use std::{fs::OpenOptions, io::Write}; use std::{fs::OpenOptions, io::Write};
use chrono::Local; use chrono::{Datelike, Local};
use rocket::{ use rocket::{
catch, catchers, catch, catchers,
fairing::{AdHoc, Fairing, Info, Kind}, fairing::{AdHoc, Fairing, Info, Kind},
@ -63,6 +63,11 @@ async fn index(db: &State<SqlitePool>, user: User, flash: Option<FlashMessage<'_
context.insert("last_trips", &last_trips); context.insert("last_trips", &last_trips);
} }
let date = chrono::Utc::now();
if date.month() <= 3 || date.month() >= 10 {
context.insert("show_quick_ergo_button", "yes");
}
context.insert("achievements", &Achievements::for_user(db, &user).await); context.insert("achievements", &Achievements::for_user(db, &user).await);
context.insert("notifications", &Notification::for_user(db, &user).await); context.insert("notifications", &Notification::for_user(db, &user).await);
context.insert("loggedin_user", &UserWithDetails::from_user(user, db).await); context.insert("loggedin_user", &UserWithDetails::from_user(user, db).await);

View File

@ -12,6 +12,15 @@
<span class="text-xl px-3">Geplante Ausfahrten</span> <span class="text-xl px-3">Geplante Ausfahrten</span>
</a> </a>
</div> </div>
{% if show_quick_ergo_button %}
<div class="m-auto">
<a href="/ergo"
class="btn btn-primary flex items-center justify-center">
{% include "includes/rowing-icon" %}
<span class="text-xl px-3">Ergo-Challenge</span>
</a>
</div>
{% endif %}
{% if notifications %} {% if notifications %}
<div id="notification" <div id="notification"
class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5" class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow mt-5"