From b6d58077f64d9b5cf7965a662ec96d358359ca8f Mon Sep 17 00:00:00 2001 From: philipp Date: Tue, 3 Sep 2024 22:55:58 +0300 Subject: [PATCH 1/6] start with aequatorpreis --- src/model/user.rs | 65 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/src/model/user.rs b/src/model/user.rs index d5f8a41..e56e611 100644 --- a/src/model/user.rs +++ b/src/model/user.rs @@ -24,6 +24,71 @@ use crate::{ SCHECKBUCH, STUDENT_OR_PUPIL, UNTERSTUETZEND, }; +mod aequatorpreis { + use chrono::{Datelike, Local, NaiveDate}; + + use super::User; + + enum AgeBracket { + Till14, + From14Till18, + From19Till30, + From31Till60, + From61Till75, + From76, + } + + impl TryFrom<&User> for AgeBracket { + type Error = String; + + fn try_from(value: &User) -> Result { + if let Some(birthdate) = value.birthdate.clone() { + let today = Local::now().date_naive(); + let birthdate = NaiveDate::parse_from_str(&birthdate, "%Y-%m-%d").unwrap(); + + let age = today.year() - birthdate.year(); + if age <= 14 { + Ok(AgeBracket::Till14) + } else if age <= 18 { + Ok(AgeBracket::From14Till18) + } else if age <= 30 { + Ok(AgeBracket::From19Till30) + } else if age <= 60 { + Ok(AgeBracket::From31Till60) + } else if age <= 75 { + Ok(AgeBracket::From61Till75) + } else { + Ok(AgeBracket::From76) + } + } else { + Err("User has no birthdate".to_string()) + } + } + } + + fn cat(value: &AgeBracket) -> &str { + match value { + AgeBracket::Till14 => "Schülerinnen und Schüler bis 14 Jahre", + AgeBracket::From14Till18 => "Juniorinnen und Junioren, Para-Ruderer bis 18 Jahre", + AgeBracket::From19Till30 => "Frauen und Männer, Para-Ruderer bis 30 Jahre", + AgeBracket::From31Till60 => "Frauen und Männer, Para-Ruderer von 31 bis 60 Jahre", + AgeBracket::From61Till75 => "Frauen und Männer, Para-Ruderer von 61 bis 75 Jahre", + AgeBracket::From76 => "Frauen und Männer, Para-Ruderer ab 76 Jahre", + } + } + + fn dist_in_km(value: &AgeBracket) -> u32 { + match value { + AgeBracket::Till14 => 500, + AgeBracket::From14Till18 => 1000, + AgeBracket::From19Till30 => 1200, + AgeBracket::From31Till60 => 1000, + AgeBracket::From61Till75 => 800, + AgeBracket::From76 => 600, + } + } +} + #[derive(FromRow, Serialize, Deserialize, Clone, Debug, Eq, Hash, PartialEq)] pub struct User { pub id: i64, -- 2.45.2 From f41b5e9fefa70ad18df2c48807093d7bc4af8c4e Mon Sep 17 00:00:00 2001 From: philipp Date: Wed, 4 Sep 2024 10:01:59 +0300 Subject: [PATCH 2/6] restructure for equatorprice --- src/model/mod.rs | 1 + src/model/personal/equatorprice.rs | 58 ++++++++++++++++++++++++++ src/model/personal/mod.rs | 21 ++++++++++ src/model/personal/rowingbadge.rs | 62 ++++++++++++++++++++++++++++ src/model/user.rs | 65 ------------------------------ src/tera/mod.rs | 2 + templates/index.html.tera | 26 ++++++++++++ 7 files changed, 170 insertions(+), 65 deletions(-) create mode 100644 src/model/personal/equatorprice.rs create mode 100644 src/model/personal/mod.rs create mode 100644 src/model/personal/rowingbadge.rs diff --git a/src/model/mod.rs b/src/model/mod.rs index 1af7c21..46446db 100644 --- a/src/model/mod.rs +++ b/src/model/mod.rs @@ -25,6 +25,7 @@ pub mod logbook; pub mod logtype; pub mod mail; pub mod notification; +pub mod personal; pub mod role; pub mod rower; pub mod stat; diff --git a/src/model/personal/equatorprice.rs b/src/model/personal/equatorprice.rs new file mode 100644 index 0000000..ef67ce5 --- /dev/null +++ b/src/model/personal/equatorprice.rs @@ -0,0 +1,58 @@ +use serde::Serialize; + +#[derive(Serialize)] +enum Level { + BRONZE, + SILVER, + GOLD, + DIAMOND, + DONE, +} + +impl Level { + fn required_km(&self) -> i32 { + match self { + Level::BRONZE => 40000, + Level::SILVER => 80000, + Level::GOLD => 100000, + Level::DIAMOND => 200000, + Level::DONE => 0, + } + } + + fn next_level(km: i32) -> Self { + if km < Level::BRONZE.required_km() { + Level::BRONZE + } else if km < Level::SILVER.required_km() { + Level::SILVER + } else if km < Level::GOLD.required_km() { + Level::GOLD + } else if km < Level::DIAMOND.required_km() { + Level::BRONZE + } else { + Level::DONE + } + } +} + +#[derive(Serialize)] +pub(crate) struct Next { + level: Level, + missing_km: i32, + required_km: i32, + rowed_km: i32, +} + +impl Next { + pub(crate) fn rowed_km(km: i32) -> Self { + let level = Level::next_level(km); + let required_km = level.required_km(); + let missing_km = required_km - km; + Self { + level, + missing_km, + required_km, + rowed_km: km, + } + } +} diff --git a/src/model/personal/mod.rs b/src/model/personal/mod.rs new file mode 100644 index 0000000..a1dd59c --- /dev/null +++ b/src/model/personal/mod.rs @@ -0,0 +1,21 @@ +use serde::Serialize; +use sqlx::SqlitePool; + +use super::{stat::Stat, user::User}; + +pub(crate) mod equatorprice; +pub(crate) mod rowingbadge; + +#[derive(Serialize)] +pub(crate) struct Achievements { + equatorprice: equatorprice::Next, +} + +impl Achievements { + pub(crate) async fn for_user(db: &SqlitePool, user: &User) -> Self { + let rowed_km = Stat::person(db, None, user).await.rowed_km; + Self { + equatorprice: equatorprice::Next::rowed_km(rowed_km), + } + } +} diff --git a/src/model/personal/rowingbadge.rs b/src/model/personal/rowingbadge.rs new file mode 100644 index 0000000..006d7e9 --- /dev/null +++ b/src/model/personal/rowingbadge.rs @@ -0,0 +1,62 @@ +use chrono::{Datelike, Local, NaiveDate}; + +use crate::model::user::User; + +enum AgeBracket { + Till14, + From14Till18, + From19Till30, + From31Till60, + From61Till75, + From76, +} + +impl TryFrom<&User> for AgeBracket { + type Error = String; + + fn try_from(value: &User) -> Result { + if let Some(birthdate) = value.birthdate.clone() { + let today = Local::now().date_naive(); + let birthdate = NaiveDate::parse_from_str(&birthdate, "%Y-%m-%d").unwrap(); + + let age = today.year() - birthdate.year(); + if age <= 14 { + Ok(AgeBracket::Till14) + } else if age <= 18 { + Ok(AgeBracket::From14Till18) + } else if age <= 30 { + Ok(AgeBracket::From19Till30) + } else if age <= 60 { + Ok(AgeBracket::From31Till60) + } else if age <= 75 { + Ok(AgeBracket::From61Till75) + } else { + Ok(AgeBracket::From76) + } + } else { + Err("User has no birthdate".to_string()) + } + } +} + +fn cat(value: &AgeBracket) -> &str { + match value { + AgeBracket::Till14 => "Schülerinnen und Schüler bis 14 Jahre", + AgeBracket::From14Till18 => "Juniorinnen und Junioren, Para-Ruderer bis 18 Jahre", + AgeBracket::From19Till30 => "Frauen und Männer, Para-Ruderer bis 30 Jahre", + AgeBracket::From31Till60 => "Frauen und Männer, Para-Ruderer von 31 bis 60 Jahre", + AgeBracket::From61Till75 => "Frauen und Männer, Para-Ruderer von 61 bis 75 Jahre", + AgeBracket::From76 => "Frauen und Männer, Para-Ruderer ab 76 Jahre", + } +} + +fn dist_in_km(value: &AgeBracket) -> u32 { + match value { + AgeBracket::Till14 => 500, + AgeBracket::From14Till18 => 1000, + AgeBracket::From19Till30 => 1200, + AgeBracket::From31Till60 => 1000, + AgeBracket::From61Till75 => 800, + AgeBracket::From76 => 600, + } +} diff --git a/src/model/user.rs b/src/model/user.rs index e56e611..d5f8a41 100644 --- a/src/model/user.rs +++ b/src/model/user.rs @@ -24,71 +24,6 @@ use crate::{ SCHECKBUCH, STUDENT_OR_PUPIL, UNTERSTUETZEND, }; -mod aequatorpreis { - use chrono::{Datelike, Local, NaiveDate}; - - use super::User; - - enum AgeBracket { - Till14, - From14Till18, - From19Till30, - From31Till60, - From61Till75, - From76, - } - - impl TryFrom<&User> for AgeBracket { - type Error = String; - - fn try_from(value: &User) -> Result { - if let Some(birthdate) = value.birthdate.clone() { - let today = Local::now().date_naive(); - let birthdate = NaiveDate::parse_from_str(&birthdate, "%Y-%m-%d").unwrap(); - - let age = today.year() - birthdate.year(); - if age <= 14 { - Ok(AgeBracket::Till14) - } else if age <= 18 { - Ok(AgeBracket::From14Till18) - } else if age <= 30 { - Ok(AgeBracket::From19Till30) - } else if age <= 60 { - Ok(AgeBracket::From31Till60) - } else if age <= 75 { - Ok(AgeBracket::From61Till75) - } else { - Ok(AgeBracket::From76) - } - } else { - Err("User has no birthdate".to_string()) - } - } - } - - fn cat(value: &AgeBracket) -> &str { - match value { - AgeBracket::Till14 => "Schülerinnen und Schüler bis 14 Jahre", - AgeBracket::From14Till18 => "Juniorinnen und Junioren, Para-Ruderer bis 18 Jahre", - AgeBracket::From19Till30 => "Frauen und Männer, Para-Ruderer bis 30 Jahre", - AgeBracket::From31Till60 => "Frauen und Männer, Para-Ruderer von 31 bis 60 Jahre", - AgeBracket::From61Till75 => "Frauen und Männer, Para-Ruderer von 61 bis 75 Jahre", - AgeBracket::From76 => "Frauen und Männer, Para-Ruderer ab 76 Jahre", - } - } - - fn dist_in_km(value: &AgeBracket) -> u32 { - match value { - AgeBracket::Till14 => 500, - AgeBracket::From14Till18 => 1000, - AgeBracket::From19Till30 => 1200, - AgeBracket::From31Till60 => 1000, - AgeBracket::From61Till75 => 800, - AgeBracket::From76 => 600, - } - } -} - #[derive(FromRow, Serialize, Deserialize, Clone, Debug, Eq, Hash, PartialEq)] pub struct User { pub id: i64, diff --git a/src/tera/mod.rs b/src/tera/mod.rs index 7bcc1ba..e49e053 100644 --- a/src/tera/mod.rs +++ b/src/tera/mod.rs @@ -24,6 +24,7 @@ use crate::{ model::{ logbook::Logbook, notification::Notification, + personal::Achievements, role::Role, user::{User, UserWithDetails}, }, @@ -62,6 +63,7 @@ async fn index(db: &State, user: User, flash: Option {% endif %} {% if "Donau Linz" in loggedin_user.roles and "Unterstützend" not in loggedin_user.roles and "Förderndes Mitglied" not in loggedin_user.roles %} + {% endmacro show %} -{% macro show_old(log, state, allowed_to_close=false, allowed_to_edit=false, index) %} +{% macro show_old(log, state, allowed_to_close=false, allowed_to_edit=false, index, hide_type=false) %}
- {% if log.logtype %} + {% if log.logtype and not hide_type %}
{% if log.logtype == 1 %} Wanderfahrt diff --git a/templates/index.html.tera b/templates/index.html.tera index 6177c0f..40286c6 100644 --- a/templates/index.html.tera +++ b/templates/index.html.tera @@ -79,25 +79,79 @@

Persönliches

-

Äquatorpreis

+

+ {% if achievements.rowingbadge and achievements.rowingbadge.achieved %}🎉{% endif %} + Fahrtenabzeichen + {% if achievements.rowingbadge %}{{ achievements.rowingbadge.year }}{% endif %} + ? +

+ {% if achievements.rowingbadge %} + {% set badge = achievements.rowingbadge %} +
{{ badge.category }}
+ + +

Wanderfahrten

+
Nur 1 muss erreicht werden
+
    +
  1. + {% if badge.multi_day_trips_over_required_distance | length >= 1 %} + ✅ + {% else %} + ❌ + {% endif %} + 1 mehrtägige Wanderfahrt > {{ badge.multi_day_trips_required_distance }} km +
  2. +
  3. + {% if badge.single_day_trips_over_required_distance | length >= 2 %} + ✅ + {% else %} + ❌ + {% endif %} + 2 eintägige Wanderfahrten > {{ badge.single_day_trips_required_distance }} km +
  4. +
+
+ Details zu den Wanderfahrten +
+ {% for log in badge.single_day_trips_over_required_distance %} + {{ log::show_old(log=log, state="completed", only_ones=false, index=loop.index) }} + {% endfor %} + {% for log in badge.multi_day_trips_over_required_distance %} + {{ log::show_old(log=log, state="completed", only_ones=false, index=loop.index) }} + {% endfor %} +
+
+ {% else %} + Wir haben leider kein Geburtsdatum von dir und können dir leider deinen heurigen Status für das Fahrtenabzeichen nicht anzeigen. Wenn du dein Geburtsdatum an it@rudernlinz.at schreibst, lässt sich das ändern :-) + {% endif %} +
+
+

+ Äquatorpreis + ? +

{% set price = achievements.equatorprice %} {% if price.level == "DONE" %} - Gratuliere, du hast alles erreicht, was es beim Äquatorpreis zu erreichen gibt. + Gratuliere, du hast alles in deinem Rudererleben erreicht, was es (beim Äquatorpreis) zu erreichen gibt. {% else %} - +
Details - Du bist insgesamt {{ price.rowed_km }} km gerudert. Um den Äquatorpreis in {{ price.level }} zu erhalten, benötigst du noch {{ price.missing_km }} um die notwendigen {{ price.required_km }} km zu erreichen. + Du bist insgesamt {{ price.rowed_km }} km gerudert. Um den Äquatorpreis in {{ price.level }} zu erhalten, benötigst du noch {{ price.missing_km }} km um die notwendigen {{ price.required_km }} km zu erreichen.
{% endif %}
-
-

Fahrtenabzeichen

-
Nachricht ausschreiben +
  • + Abzeichen +
  • {% endif %} -- 2.45.2 From b40850626b45b9b927d4d9e3f78449ce61f0fe9b Mon Sep 17 00:00:00 2001 From: philipp Date: Wed, 4 Sep 2024 19:40:52 +0300 Subject: [PATCH 4/6] improvements, styling, additional infos --- src/model/logbook.rs | 44 ++++++++ src/model/personal/equatorprice.rs | 3 +- src/model/personal/mod.rs | 20 ++-- src/model/personal/rowingbadge.rs | 39 +++---- templates/achievement.html.tera | 30 ++++-- templates/index.html.tera | 163 +++++++++++++++++------------ 6 files changed, 192 insertions(+), 107 deletions(-) diff --git a/src/model/logbook.rs b/src/model/logbook.rs index 4134cbb..86025fe 100644 --- a/src/model/logbook.rs +++ b/src/model/logbook.rs @@ -299,6 +299,50 @@ ORDER BY departure DESC ret } + pub async fn year_first_logbook_entry(db: &SqlitePool, user: &User) -> Option { + let log: Option = sqlx::query_as( + &format!(" + SELECT id, boat_id, shipmaster, steering_person, shipmaster_only_steering, departure, arrival, destination, distance_in_km, comments, logtype + FROM logbook + JOIN rower ON logbook.id = rower.logbook_id + WHERE arrival is not null AND rower_id = {} + ORDER BY arrival + LIMIT 1 + ", user.id) + ) + .fetch_optional(db) + .await + .unwrap(); //TODO: fixme + + if let Some(log) = log { + Some(log.arrival.unwrap().year()) + } else { + None + } + } + + pub async fn year_last_logbook_entry(db: &SqlitePool, user: &User) -> Option { + let log: Option = sqlx::query_as( + &format!(" + SELECT id, boat_id, shipmaster, steering_person, shipmaster_only_steering, departure, arrival, destination, distance_in_km, comments, logtype + FROM logbook + JOIN rower ON logbook.id = rower.logbook_id + WHERE arrival is not null AND rower_id = {} + ORDER BY arrival DESC + LIMIT 1 + ", user.id) + ) + .fetch_optional(db) + .await + .unwrap(); //TODO: fixme + + if let Some(log) = log { + Some(log.arrival.unwrap().year()) + } else { + None + } + } + pub(crate) async fn completed_wanderfahrten_with_user_over_km_in_year( db: &SqlitePool, user: &User, diff --git a/src/model/personal/equatorprice.rs b/src/model/personal/equatorprice.rs index e97c706..97a489a 100644 --- a/src/model/personal/equatorprice.rs +++ b/src/model/personal/equatorprice.rs @@ -1,5 +1,4 @@ use serde::Serialize; -use sqlx::SqlitePool; #[derive(Serialize, PartialEq, Debug)] pub(crate) enum Level { @@ -31,7 +30,7 @@ impl Level { } else if km < Level::GOLD.required_km() { Level::GOLD } else if km < Level::DIAMOND.required_km() { - Level::BRONZE + Level::DIAMOND } else { Level::DONE } diff --git a/src/model/personal/mod.rs b/src/model/personal/mod.rs index a91e551..cc9c53c 100644 --- a/src/model/personal/mod.rs +++ b/src/model/personal/mod.rs @@ -3,7 +3,7 @@ use equatorprice::Level; use serde::Serialize; use sqlx::SqlitePool; -use super::{stat::Stat, user::User}; +use super::{logbook::Logbook, stat::Stat, user::User}; pub(crate) mod equatorprice; pub(crate) mod rowingbadge; @@ -14,6 +14,9 @@ pub(crate) struct Achievements { pub(crate) curr_equatorprice_name: String, pub(crate) new_equatorprice_this_season: bool, pub(crate) rowingbadge: Option, + pub(crate) all_time_km: i32, + pub(crate) year_first_mentioned: Option, + pub(crate) year_last_mentioned: Option, } impl Achievements { @@ -31,25 +34,18 @@ impl Achievements { .await .rowed_km }; - println!( - "old: {}; new: {}", - rowed_km, - rowed_km - rowed_km_this_season - ); - println!( - "old: {:?}; new: {:?}", - Level::curr_level(rowed_km), - Level::curr_level(rowed_km - rowed_km_this_season) - ); + let new_equatorprice_this_season = Level::curr_level(rowed_km) != Level::curr_level(rowed_km - rowed_km_this_season); - println!("{new_equatorprice_this_season:?}"); Self { equatorprice: equatorprice::Next::new(rowed_km), curr_equatorprice_name: equatorprice::Level::curr_level(rowed_km).desc().to_string(), new_equatorprice_this_season, rowingbadge: rowingbadge::Status::for_user(db, user).await, + all_time_km: rowed_km, + year_first_mentioned: Logbook::year_first_logbook_entry(db, user).await, + year_last_mentioned: Logbook::year_last_logbook_entry(db, user).await, } } } diff --git a/src/model/personal/rowingbadge.rs b/src/model/personal/rowingbadge.rs index 32093b7..446b886 100644 --- a/src/model/personal/rowingbadge.rs +++ b/src/model/personal/rowingbadge.rs @@ -69,26 +69,29 @@ impl TryFrom<&User> for AgeBracket { type Error = String; fn try_from(value: &User) -> Result { - if let Some(birthdate) = value.birthdate.clone() { - let today = Local::now().date_naive(); - let birthdate = NaiveDate::parse_from_str(&birthdate, "%Y-%m-%d").unwrap(); + let Some(birthdate) = value.birthdate.clone() else { + return Err("User has no birthdate".to_string()); + }; - let age = today.year() - birthdate.year(); - if age <= 14 { - Ok(AgeBracket::Till14) - } else if age <= 18 { - Ok(AgeBracket::From14Till18) - } else if age <= 30 { - Ok(AgeBracket::From19Till30) - } else if age <= 60 { - Ok(AgeBracket::From31Till60) - } else if age <= 75 { - Ok(AgeBracket::From61Till75) - } else { - Ok(AgeBracket::From76) - } + let Ok(birthdate) = NaiveDate::parse_from_str(&birthdate, "%Y-%m-%d") else { + return Err("Birthdate in wrong format...".to_string()); + }; + + let today = Local::now().date_naive(); + + let age = today.year() - birthdate.year(); + if age <= 14 { + Ok(AgeBracket::Till14) + } else if age <= 18 { + Ok(AgeBracket::From14Till18) + } else if age <= 30 { + Ok(AgeBracket::From19Till30) + } else if age <= 60 { + Ok(AgeBracket::From31Till60) + } else if age <= 75 { + Ok(AgeBracket::From61Till75) } else { - Err("User has no birthdate".to_string()) + Ok(AgeBracket::From76) } } } diff --git a/templates/achievement.html.tera b/templates/achievement.html.tera index 63dd412..4232520 100644 --- a/templates/achievement.html.tera +++ b/templates/achievement.html.tera @@ -3,15 +3,19 @@ {% extends "base" %} {% block content %} -
    +

    Abzeichen für {{ rowingbadge_year }}

    - - + + + + + + @@ -24,7 +28,15 @@ {% set achievement = person.1 %} - + + + + + {% if achievement.rowingbadge %} {% set badge = achievement.rowingbadge %} {% else %} - - - - - + + + + + {% endif %} {% endfor %} diff --git a/templates/index.html.tera b/templates/index.html.tera index 40286c6..bc5c3c3 100644 --- a/templates/index.html.tera +++ b/templates/index.html.tera @@ -79,78 +79,109 @@

    Persönliches

    -

    - {% if achievements.rowingbadge and achievements.rowingbadge.achieved %}🎉{% endif %} - Fahrtenabzeichen - {% if achievements.rowingbadge %}{{ achievements.rowingbadge.year }}{% endif %} - + +

    + + {% if achievements.rowingbadge and achievements.rowingbadge.achieved %} + 🎉 + {% else %} + 📋 + {% endif %} + + Fahrtenabzeichen + {% if achievements.rowingbadge %}{{ achievements.rowingbadge.year }}{% endif %} + ? -

    - {% if achievements.rowingbadge %} - {% set badge = achievements.rowingbadge %} -
    {{ badge.category }}
    - - -

    Wanderfahrten

    -
    Nur 1 muss erreicht werden
    -
      -
    1. - {% if badge.multi_day_trips_over_required_distance | length >= 1 %} - ✅ - {% else %} - ❌ - {% endif %} - 1 mehrtägige Wanderfahrt > {{ badge.multi_day_trips_required_distance }} km -
    2. -
    3. - {% if badge.single_day_trips_over_required_distance | length >= 2 %} - ✅ - {% else %} - ❌ - {% endif %} - 2 eintägige Wanderfahrten > {{ badge.single_day_trips_required_distance }} km -
    4. -
    -
    - Details zu den Wanderfahrten + class="w-6 h-6 inline-flex align-center justify-center rounded-full bg-primary-500 ml-2">? +

    + + {% if achievements.rowingbadge %} + {% set badge = achievements.rowingbadge %} +
    {{ badge.category }}
    + + +

    Wanderfahrten

    +
    Nur 1 muss erreicht werden
    +
      +
    1. + {% if badge.multi_day_trips_over_required_distance | length >= 1 %} + ✅ + {% else %} + ❌ + {% endif %} + 1 mehrtägige Wanderfahrt > {{ badge.multi_day_trips_required_distance }} km +
    2. +
    3. + {% if badge.single_day_trips_over_required_distance | length >= 2 %} + ✅ + {% else %} + ❌ + {% endif %} + 2 eintägige Wanderfahrten > {{ badge.single_day_trips_required_distance }} km +
    4. +
    +
    + Details zu den Wanderfahrten +
    + {% for log in badge.single_day_trips_over_required_distance %} + {{ log::show_old(log=log, state="completed", only_ones=false, index=loop.index) }} + {% endfor %} + {% for log in badge.multi_day_trips_over_required_distance %} + {{ log::show_old(log=log, state="completed", only_ones=false, index=loop.index) }} + {% endfor %} +
    +
    + {% else %}
    - {% for log in badge.single_day_trips_over_required_distance %} - {{ log::show_old(log=log, state="completed", only_ones=false, index=loop.index) }} - {% endfor %} - {% for log in badge.multi_day_trips_over_required_distance %} - {{ log::show_old(log=log, state="completed", only_ones=false, index=loop.index) }} - {% endfor %} + Wir haben leider kein Geburtsdatum von dir und können dir leider deinen heurigen Status für das Fahrtenabzeichen nicht anzeigen. Wenn du dein Geburtsdatum an it@rudernlinz.at schreibst, lässt sich das ändern :-)
    - - {% else %} - Wir haben leider kein Geburtsdatum von dir und können dir leider deinen heurigen Status für das Fahrtenabzeichen nicht anzeigen. Wenn du dein Geburtsdatum an it@rudernlinz.at schreibst, lässt sich das ändern :-) - {% endif %} + {% endif %} +
    -

    - Äquatorpreis - + +

    + {% set price = achievements.equatorprice %} + + {% if achievements.curr_equatorprice_name == "-" %} + 📋 + {% elif achievements.curr_equatorprice_name == "Bronze" %} + 🥉 + {% elif achievements.curr_equatorprice_name == "Silber" %} + 🥈 + {% elif achievements.curr_equatorprice_name == "Gold" %} + 🥇 + {% elif achievements.curr_equatorprice_name == "Diamant" %} + 💍 + {% endif %} + + Äquatorpreis + ? -

    - {% set price = achievements.equatorprice %} - {% if price.level == "DONE" %} - Gratuliere, du hast alles in deinem Rudererleben erreicht, was es (beim Äquatorpreis) zu erreichen gibt. - {% else %} - - -
    - Details - Du bist insgesamt {{ price.rowed_km }} km gerudert. Um den Äquatorpreis in {{ price.level }} zu erhalten, benötigst du noch {{ price.missing_km }} km um die notwendigen {{ price.required_km }} km zu erreichen. -
    - {% endif %} + class="w-6 h-6 inline-flex align-center justify-center rounded-full bg-primary-500 ml-2">? +

    + +
    + {% if price.level == "DONE" %} + Gratuliere, du hast alles in deinem Rudererleben erreicht, was es (beim Äquatorpreis) zu erreichen gibt. + {% else %} + + +
    + Details + Du bist insgesamt {{ price.rowed_km }} km gerudert. Um den Äquatorpreis in {{ price.desc }} zu erhalten, benötigst du noch {{ price.missing_km }} km um die notwendigen {{ price.required_km }} km zu erreichen. +
    + {% endif %} +
    +
    -- 2.45.2 From 5f21148b3c67578c0c05e15dd679cc072130405e Mon Sep 17 00:00:00 2001 From: philipp Date: Wed, 4 Sep 2024 20:00:25 +0300 Subject: [PATCH 5/6] improved text --- templates/index.html.tera | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/templates/index.html.tera b/templates/index.html.tera index bc5c3c3..f43b6d8 100644 --- a/templates/index.html.tera +++ b/templates/index.html.tera @@ -74,9 +74,15 @@ {% endif %} {% if "Donau Linz" in loggedin_user.roles and "Unterstützend" not in loggedin_user.roles and "Förderndes Mitglied" not in loggedin_user.roles %} + + Du hast Ideen für sinnvolle, neue Funktionen für diese Ruderapp? Melde dich bei Philipp, Marie oder it@rudernlinz.at. +
    x
    +
    - - - + + + - - + + @@ -28,15 +36,21 @@ {% set achievement = person.1 %} - - - + + + + - {% if achievement.rowingbadge %} {% set badge = achievement.rowingbadge %}
    NameÄquatorpreisFahrtenabzeichen (FA) geschafftErster LogLetzter LogGesamt-KMÄquatorpreis (ÄP)ÄP diese
    Saison bekommen
    Fahrtenabzeichen (FA)
    geschafft
    FA - KM FA - fehlende KM Eintagesausfahrten
    {{ user.name }}{% if achievement.new_equatorprice_this_season %}(NEU!) {% endif %}{{ achievement.curr_equatorprice_name }} {% if achievement.year_first_mentioned %}{{ achievement.year_first_mentioned }}{% endif %}{% if achievement.year_last_mentioned %}{{ achievement.year_last_mentioned }}{% endif %}{{ achievement.all_time_km }} + {{ achievement.curr_equatorprice_name }} + + {% if achievement.new_equatorprice_this_season %}🎉{% else %}-{% endif %} + @@ -57,11 +69,11 @@ no birthdate of this personno birthdate of this personno birthdate of this personno birthdate of this personno birthdate of this personGeb.datum fehlt 👻Geb.datum fehlt 👻Geb.datum fehlt 👻Geb.datum fehlt 👻Geb.datum fehlt 👻
    NameErster LogLetzter LogGesamt-KMErster LogLetzter LogGesamt-KM Äquatorpreis (ÄP)ÄP diese
    Saison bekommen
    Fahrtenabzeichen (FA)
    geschafft
    + ÄP diese +
    + Saison bekommen +
    + Fahrtenabzeichen (FA) +
    + geschafft +
    FA - KM FA - fehlende KM Eintagesausfahrten
    {{ user.name }}{% if achievement.year_first_mentioned %}{{ achievement.year_first_mentioned }}{% endif %}{% if achievement.year_last_mentioned %}{{ achievement.year_last_mentioned }}{% endif %}{{ achievement.all_time_km }} - {{ achievement.curr_equatorprice_name }} + {% if achievement.year_first_mentioned %}{{ achievement.year_first_mentioned }}{% endif %} + + {% if achievement.year_last_mentioned %}{{ achievement.year_last_mentioned }}{% endif %} + {{ achievement.all_time_km }}{{ achievement.curr_equatorprice_name }} + {% if achievement.new_equatorprice_this_season %} + 🎉 + {% else %} + - + {% endif %} - {% if achievement.new_equatorprice_this_season %}🎉{% else %}-{% endif %} - diff --git a/templates/index.html.tera b/templates/index.html.tera index f43b6d8..d35a858 100644 --- a/templates/index.html.tera +++ b/templates/index.html.tera @@ -74,15 +74,30 @@ {% endif %} {% if "Donau Linz" in loggedin_user.roles and "Unterstützend" not in loggedin_user.roles and "Förderndes Mitglied" not in loggedin_user.roles %} - - Du hast Ideen für sinnvolle, neue Funktionen für diese Ruderapp? Melde dich bei Philipp, Marie oder it@rudernlinz.at. -
    x
    -
    + +
    + +
    +

    + Du hast Ideen für sinnvolle neue Funktionen für diese Ruderapp? Melde dich bei Philipp, Marie oder it@rudernlinz.at. +

    +

    + +Wenn du darüber hinaus Lust hast, deine Skills in ein Projekt zu stecken, das Wellen schlagen wird (😀), dann komm an Bord! Wir sind offen für frische Ideen, haben jedoch auch selber noch genügend; langweilig wird uns bestimmt nicht. +

    +
    +
    +