17 Commits

Author SHA1 Message Date
1add5c2a2a Merge pull request 'enable self-enrollment to ergo challenge' (#1148) from allow-ergo-entry into main
All checks were successful
CI/CD Pipeline / test (push) Successful in 15m55s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Successful in 8m53s
Reviewed-on: #1148
2025-10-07 19:09:23 +02:00
567f31dd3d enable self-enrollment to ergo challenge
Some checks failed
CI/CD Pipeline / deploy-staging (push) Has been cancelled
CI/CD Pipeline / test (push) Has been cancelled
CI/CD Pipeline / deploy-main (push) Has been cancelled
2025-10-07 19:08:20 +02:00
eec485dced Merge pull request 'allow ergo entry' (#1146) from allow-ergo-entry into main
Some checks failed
CI/CD Pipeline / test (push) Failing after 2m28s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #1146
2025-10-07 18:54:03 +02:00
b48b689aeb allow ergo entry
Some checks failed
CI/CD Pipeline / deploy-staging (push) Has been cancelled
CI/CD Pipeline / deploy-main (push) Has been cancelled
CI/CD Pipeline / test (push) Has been cancelled
2025-10-07 18:53:13 +02:00
9f57cbaa71 Merge pull request 'add-ergo-role' (#1143) from add-ergo-role into main
All checks were successful
CI/CD Pipeline / test (push) Successful in 15m49s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Successful in 8m49s
Reviewed-on: #1143
2025-10-07 16:53:06 +02:00
Philipp Hofer
284a853344 nicer formatting
Some checks failed
CI/CD Pipeline / deploy-staging (push) Has been cancelled
CI/CD Pipeline / test (push) Has been cancelled
CI/CD Pipeline / deploy-main (push) Has been cancelled
2025-10-07 16:52:01 +02:00
Philipp Hofer
ebce600356 also show button again
All checks were successful
CI/CD Pipeline / test (push) Successful in 19m25s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped
2025-10-07 16:04:44 +02:00
6e418b6f2f Merge pull request 'fix-cii' (#1140) from fix-cii into staging
Some checks failed
Update Cargo Dependencies / update-dependencies (push) Successful in 2m19s
CI/CD Pipeline / test (push) Has started running
CI/CD Pipeline / deploy-staging (push) Has been cancelled
CI/CD Pipeline / deploy-main (push) Has been cancelled
Reviewed-on: #1140
2025-10-02 09:02:39 +02:00
328a8e3e35 Merge pull request 'fix-cii' (#1139) from fix-cii into main
Some checks failed
CI/CD Pipeline / test (push) Failing after 41m48s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #1139
2025-10-02 09:02:28 +02:00
bfb95610f6 fix ci?
All checks were successful
CI/CD Pipeline / test (push) Successful in 32m54s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped
2025-10-02 08:40:46 +02:00
68674dd1c5 debug
Some checks failed
CI/CD Pipeline / deploy-staging (push) Has been cancelled
CI/CD Pipeline / deploy-main (push) Has been cancelled
CI/CD Pipeline / test (push) Has been cancelled
2025-10-02 08:38:03 +02:00
9a16ce0c21 Merge pull request 'restore-fix-ci' (#1138) from restore-fix-ci into staging
Some checks failed
CI/CD Pipeline / test (push) Failing after 17m53s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #1138
2025-10-02 00:35:29 +02:00
16689318eb Merge pull request 'Restore content from fix-ci-finally' (#1137) from restore-fix-ci into main
Some checks failed
CI/CD Pipeline / test (push) Failing after 21m49s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #1137
2025-10-02 00:35:21 +02:00
b12ea81bbf Restore content from fix-ci-finally
Some checks failed
CI/CD Pipeline / test (push) Has been cancelled
CI/CD Pipeline / deploy-staging (push) Has been cancelled
CI/CD Pipeline / deploy-main (push) Has been cancelled
2025-10-02 00:34:12 +02:00
49a638d595 Merge pull request 'replace-main-with-fix' (#1136) from replace-main-with-fix into main
Some checks failed
CI/CD Pipeline / test (push) Has been cancelled
CI/CD Pipeline / deploy-staging (push) Has been cancelled
CI/CD Pipeline / deploy-main (push) Has been cancelled
Reviewed-on: #1136
2025-10-02 00:32:24 +02:00
e1803aea3e Merge pull request 'update deps, fix ci' (#1134) from no-ergo into main
Some checks failed
CI/CD Pipeline / test (push) Failing after 51m37s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #1134
2025-10-01 22:41:40 +02:00
72c19d7a75 Merge pull request 'no ergo yet' (#1132) from no-ergo into main
Some checks failed
CI/CD Pipeline / test (push) Failing after 16m2s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #1132
2025-10-01 20:25:08 +02:00
7 changed files with 92 additions and 74 deletions

View File

@@ -17,6 +17,9 @@ jobs:
- name: Run Test DB Script - name: Run Test DB Script
run: ./test_db.sh run: ./test_db.sh
- name: Test
run: npm --version
- name: Cache Cargo dependencies - name: Cache Cargo dependencies
uses: Swatinem/rust-cache@v2 uses: Swatinem/rust-cache@v2

View File

@@ -425,10 +425,8 @@ function initNewChoice(select: HTMLInputElement) {
maxItemText: (maxItemCount) => { maxItemText: (maxItemCount) => {
return `Nur ${maxItemCount} Ruderer können hinzugefügt werden`; return `Nur ${maxItemCount} Ruderer können hinzugefügt werden`;
}, },
callbackOnInit: function (this: Choices) { callbackOnInit: function () {
const items = this.getValue(); // Get all selected items this._currentState.items.forEach(function (obj) {
const itemsArray = Array.isArray(items) ? items : [items];
itemsArray.forEach((obj: any) => {
if (boat_in_ottensheim && obj.customProperties) { if (boat_in_ottensheim && obj.customProperties) {
if (obj.customProperties.is_racing) { if (obj.customProperties.is_racing) {
const coxSelect = <HTMLSelectElement>( const coxSelect = <HTMLSelectElement>(

View File

@@ -9,20 +9,20 @@
"preview": "vite preview" "preview": "vite preview"
}, },
"devDependencies": { "devDependencies": {
"@playwright/test": "^1.55.1", "@playwright/test": "^1.40.1",
"@types/d3": "^7.4.3", "@types/d3": "^7.4.1",
"@types/node": "^24.6.1", "@types/node": "^20.11.4",
"autoprefixer": "^10.4.21", "autoprefixer": "^10.4.14",
"postcss": "^8.5.6", "postcss": "^8.4.21",
"sass": "^1.93.2", "sass": "^1.60.0",
"tailwindcss": "^3.4.18", "tailwindcss": "^3.3.1",
"typescript": "^5.9.3", "typescript": "^5.9.3",
"vite": "^7.1.7", "vite": "^4.2.0",
"vite-plugin-static-copy": "^3.1.3" "vite-plugin-static-copy": "^0.13.1"
}, },
"dependencies": { "dependencies": {
"choices.js": "^11.1.0", "choices.js": "^10.2.0",
"d3": "^7.9.0", "d3": "^7.8.5",
"terser": "^5.44.0" "terser": "^5.21.0"
} }
} }

View File

@@ -860,6 +860,7 @@ special_user!(AllowedForPlannedTripsUser, +"Donau Linz", +"scheckbuch", +"Förde
special_user!(DonauLinzUser, +"Donau Linz", +"Förderndes Mitglied", -"Unterstützend"); // TODO: special_user!(DonauLinzUser, +"Donau Linz", +"Förderndes Mitglied", -"Unterstützend"); // TODO:
// remove -> // remove ->
// RegularUser // RegularUser
special_user!(ErgoAdminUser, +"ergo-admin", +"admin");
special_user!(SchnupperBetreuerUser, +"schnupper-betreuer"); special_user!(SchnupperBetreuerUser, +"schnupper-betreuer");
special_user!(VorstandUser, +"admin", +"Vorstand"); special_user!(VorstandUser, +"admin", +"Vorstand");
special_user!(EventUser, +"manage_events"); special_user!(EventUser, +"manage_events");

View File

@@ -1,8 +1,7 @@
use std::env; use std::env;
use chrono::Utc; use chrono::{Datelike, Utc};
use rocket::{ use rocket::{
FromForm, Route, State,
form::Form, form::Form,
fs::TempFile, fs::TempFile,
get, get,
@@ -10,18 +9,19 @@ use rocket::{
post, post,
request::FlashMessage, request::FlashMessage,
response::{Flash, Redirect}, response::{Flash, Redirect},
routes, routes, FromForm, Route, State,
}; };
use rocket_dyn_templates::{Template, context}; use rocket_dyn_templates::{context, Template};
use serde::Serialize; use serde::Serialize;
use sqlx::SqlitePool; use sqlx::SqlitePool;
use tera::Context; use tera::Context;
use crate::model::{ use crate::model::{
activity::ActivityBuilder,
log::Log, log::Log,
notification::Notification, notification::Notification,
role::Role, role::Role,
user::{AdminUser, User, UserWithDetails}, user::{AdminUser, ErgoAdminUser, User, UserWithDetails},
}; };
#[derive(Serialize)] #[derive(Serialize)]
@@ -59,7 +59,7 @@ async fn send(db: &State<SqlitePool>, _user: AdminUser) -> Template {
} }
#[get("/reset")] #[get("/reset")]
async fn reset(db: &State<SqlitePool>, _user: AdminUser) -> Flash<Redirect> { async fn reset(db: &State<SqlitePool>, _user: ErgoAdminUser) -> Flash<Redirect> {
sqlx::query!("UPDATE user SET dirty_thirty = NULL, dirty_dozen = NULL;") sqlx::query!("UPDATE user SET dirty_thirty = NULL, dirty_dozen = NULL;")
.execute(db.inner()) .execute(db.inner())
.await .await
@@ -74,7 +74,7 @@ async fn reset(db: &State<SqlitePool>, _user: AdminUser) -> Flash<Redirect> {
#[get("/<challenge>/user/<user_id>/new?<new>")] #[get("/<challenge>/user/<user_id>/new?<new>")]
async fn update( async fn update(
db: &State<SqlitePool>, db: &State<SqlitePool>,
_admin: AdminUser, _admin: ErgoAdminUser,
challenge: &str, challenge: &str,
user_id: i64, user_id: i64,
new: &str, new: &str,
@@ -146,47 +146,61 @@ pub struct UserAdd {
sex: String, sex: String,
} }
//#[post("/set-data", data = "<data>")] #[post("/set-data", data = "<data>")]
//async fn new_user(db: &State<SqlitePool>, data: Form<UserAdd>, user: User) -> Flash<Redirect> { async fn new_user(db: &State<SqlitePool>, data: Form<UserAdd>, user: User) -> Flash<Redirect> {
// if user.has_role(db, "ergo").await { if user.has_role(db, "ergo").await {
// return Flash::error(Redirect::to("/ergo"), "Du hast deine Daten schon eingegeben. Wenn du sie updaten willst, melde dich bitte bei it@rudernlinz.at"); return Flash::error(Redirect::to("/ergo"), "Du hast deine Daten schon eingegeben. Wenn du sie updaten willst, melde dich bitte bei info@rudernlinz.at");
// } }
//
// // check data // check data
// if data.birthyear < 1900 || data.birthyear > chrono::Utc::now().year() - 5 { if data.birthyear < 1900 || data.birthyear > chrono::Utc::now().year() - 5 {
// return Flash::error(Redirect::to("/ergo"), "Bitte überprüfe dein Geburtsjahr..."); return Flash::error(Redirect::to("/ergo"), "Bitte überprüfe dein Geburtsjahr...");
// } }
// if data.weight < 20 || data.weight > 200 { if data.weight < 20 || data.weight > 200 {
// return Flash::error(Redirect::to("/ergo"), "Bitte überprüfe dein Gewicht..."); return Flash::error(Redirect::to("/ergo"), "Bitte überprüfe dein Gewicht...");
// } }
// if &data.sex != "f" && &data.sex != "m" { if &data.sex != "f" && &data.sex != "m" {
// return Flash::error(Redirect::to("/ergo"), "Bitte überprüfe dein Geschlecht..."); return Flash::error(Redirect::to("/ergo"), "Bitte überprüfe dein Geschlecht...");
// } }
//
// // set data // set data
// user.update_ergo(db, data.birthyear, data.weight, &data.sex) user.update_ergo(db, data.birthyear, data.weight, &data.sex)
// .await; .await;
//
// // inform all other `ergo` users // inform all other `ergo` users
// let ergo = Role::find_by_name(db, "ergo").await.unwrap(); let ergo = Role::find_by_name(db, "ergo").await.unwrap();
// Notification::create_for_role( Notification::create_for_role(
// db, db,
// &ergo, &ergo,
// &format!("{} nimmt heuer an der Ergochallenge teil 💪", user.name), &format!("{} nimmt heuer an der Ergochallenge teil 💪", user.name),
// "Ergo Challenge", "Ergo Challenge",
// None, None,
// None, None,
// ) )
// .await; .await;
//
// // add to `ergo` group // add to `ergo` group
// user.add_role(db, &ergo).await.unwrap(); sqlx::query!(
// "INSERT INTO user_role(user_id, role_id) VALUES (?, ?)",
// Flash::success( user.id,
// Redirect::to("/ergo"), ergo.id
// "Du hast deine Daten erfolgreich eingegeben. Viel Spaß beim Schwitzen :-)", )
// ) .execute(db.inner())
//} .await
.unwrap();
ActivityBuilder::new(&format!(
"{user} nimmt an der Ergo-Challenge teil und hat gerade die Daten eingegeben."
))
.user(&user)
.save(db)
.await;
Flash::success(
Redirect::to("/ergo"),
"Du hast deine Daten erfolgreich eingegeben. Viel Spaß beim Schwitzen :-)",
)
}
#[derive(FromForm, Debug)] #[derive(FromForm, Debug)]
pub struct ErgoToAdd<'a> { pub struct ErgoToAdd<'a> {
@@ -359,10 +373,7 @@ async fn new_dozen(
} }
pub fn routes() -> Vec<Route> { pub fn routes() -> Vec<Route> {
routes![ routes![index, new_thirty, new_dozen, send, reset, update, new_user]
index, new_thirty, new_dozen, send, reset, update,
// new_user
]
} }
#[cfg(test)] #[cfg(test)]

View File

@@ -65,7 +65,7 @@ async fn index(db: &State<SqlitePool>, user: User, flash: Option<FlashMessage<'_
let date = chrono::Utc::now(); let date = chrono::Utc::now();
if date.month() <= 3 || date.month() >= 10 { if date.month() <= 3 || date.month() >= 10 {
// context.insert("show_quick_ergo_button", "yes"); 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);

View File

@@ -15,10 +15,7 @@
class="link-primary">Überblick der Challenges</a> class="link-primary">Überblick der Challenges</a>
</li> </li>
<li class="py-1"> <li class="py-1">
Eintragung ist jederzeit möglich, alle Daten die bis Sonntag 23:59 hier hochgeladen wurden, werden gesammelt an die Ister Ergo Challenge geschickt Eintragung ist jederzeit möglich, wenn du sie auch an die offizielle Liste schicken willst, kannst du das <a href="https://data.ergochallenge.at/" target="_blank" style="text-decoration: underline">hier</a> machen
<li class="py-1">
Montag &rarr; gemeinsames Training; bitte um <a href="/planned" class="link-primary">Anmeldung</a>, damit jeder einen Ergo hat
</li>
<li class="py-1"> <li class="py-1">
<a href="https://data.ergochallenge.at" <a href="https://data.ergochallenge.at"
target="_blank" target="_blank"
@@ -194,7 +191,7 @@
</div> </div>
</details> </details>
</div> </div>
{% if "admin" in loggedin_user.roles %} {% if "admin" in loggedin_user.roles or "ergo-admin" in loggedin_user.roles %}
<div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow grid gap-3"> <div class="bg-white dark:bg-primary-900 text-black dark:text-white rounded-md block shadow grid gap-3">
<h2 class="h2">Update</h2> <h2 class="h2">Update</h2>
<details class="p-2"> <details class="p-2">
@@ -233,6 +230,14 @@
</ol> </ol>
</div> </div>
</details> </details>
<div class="mt-3 text-right">
<a href="/ergo/reset"
class="w-28 btn btn-alert"
onclick="return confirm('Willst du wirklich alle Ergo-Eingaben löschen?');">
{% include "includes/delete-icon" %}
Einträge löschen
</a>
</div>
</div> </div>
</div> </div>
{% endif %} {% endif %}