32 Commits

Author SHA1 Message Date
a59d8c0331 Merge pull request 'enable self-enrollment to ergo challenge' (#1147) from allow-ergo-entry into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 18m23s
CI/CD Pipeline / deploy-staging (push) Successful in 10m49s
CI/CD Pipeline / deploy-main (push) Has been skipped
Update Cargo Dependencies / update-dependencies (push) Successful in 1m28s
Reviewed-on: #1147
2025-10-07 19:08:49 +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
71760a500f Merge pull request 'allow-ergo-entry' (#1145) from allow-ergo-entry into staging
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
Reviewed-on: #1145
2025-10-07 18:53:41 +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
a1b18d6f92 Merge pull request 'nicer formatting' (#1144) from add-ergo-role into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 19m13s
CI/CD Pipeline / deploy-staging (push) Successful in 9m6s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #1144
2025-10-07 16:52:57 +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
465a42acac Merge pull request 'also show button again' (#1142) from add-ergo-role into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 17m8s
CI/CD Pipeline / deploy-staging (push) Successful in 9m6s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #1142
2025-10-07 16:24:37 +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
452d257c7a Merge pull request 'replace-main-with-fix' (#1135) from replace-main-with-fix into staging
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: #1135
2025-10-02 00:32:15 +02:00
599eec0e43 Replace main content with 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:29:28 +02:00
433c914c4a fix ci
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:25:43 +02:00
0338351eef reduce npm warnings 2025-10-01 23:46:49 +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
6f491e20e5 Merge pull request 'update deps, fix ci' (#1133) from no-ergo into staging
Some checks failed
CI/CD Pipeline / test (push) Failing after 44m35s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #1133
2025-10-01 22:41:32 +02:00
7f26710a40 fix ci?
Some checks failed
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
2025-10-01 22:24:13 +02:00
9203c61541 fix ci?
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-01 22:07:21 +02:00
3a57a1334d update npm mods
Some checks failed
CI/CD Pipeline / test (push) Failing after 17m54s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped
2025-10-01 21:44:24 +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
8b25076599 Merge pull request 'no-ergo' (#1131) from no-ergo into staging
Some checks failed
CI/CD Pipeline / test (push) Failing after 17m9s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #1131
2025-10-01 20:24:26 +02:00
a44f8b445c no ergo yet
Some checks failed
CI/CD Pipeline / test (push) Failing after 25m9s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped
2025-10-01 20:23:09 +02:00
5ec457fea7 Merge pull request 'log-frontend-test-logs' (#1119) from log-frontend-test-logs into main
Some checks failed
CI/CD Pipeline / test (push) Failing after 16m52s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #1119
2025-07-24 11:51:49 +02:00
5934bbe666 Merge pull request 'get errors' (#1117) from log-frontend-test-logs into main
All checks were successful
CI/CD Pipeline / test (push) Successful in 21m13s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Successful in 8m6s
Reviewed-on: #1117
2025-07-24 11:01:53 +02:00
e9a78db048 Merge pull request 'families only have to pay einschriebgebuehr once + half price applies' (#1115) from fix-family-fees 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: #1115
2025-07-24 08:55:43 +02:00
8 changed files with 503 additions and 539 deletions

View File

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

885
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -25,8 +25,8 @@ futures = "0.3"
lettre = "0.11"
csv = "1.3"
itertools = "0.14"
job_scheduler_ng = "2.3"
ureq = { version = "3.1", features = ["json"] }
job_scheduler_ng = "2.2"
ureq = { version = "3.0", features = ["json"] }
regex = "1.11"
urlencoding = "2.1"

View File

@@ -16,7 +16,7 @@
"postcss": "^8.4.21",
"sass": "^1.60.0",
"tailwindcss": "^3.3.1",
"typescript": "^4.9.5",
"typescript": "^5.9.3",
"vite": "^4.2.0",
"vite-plugin-static-copy": "^0.13.1"
},

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:
// remove ->
// RegularUser
special_user!(ErgoAdminUser, +"ergo-admin", +"admin");
special_user!(SchnupperBetreuerUser, +"schnupper-betreuer");
special_user!(VorstandUser, +"admin", +"Vorstand");
special_user!(EventUser, +"manage_events");

View File

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

View File

@@ -2,7 +2,7 @@ use std::{fs::OpenOptions, io::Write};
use chrono::{Datelike, Local};
use rocket::{
Build, Data, FromForm, Request, Rocket, State, catch, catchers,
catch, catchers,
fairing::{AdHoc, Fairing, Info, Kind},
form::Form,
fs::FileServer,
@@ -13,6 +13,7 @@ use rocket::{
response::{Flash, Redirect},
routes,
time::{Duration, OffsetDateTime},
Build, Data, FromForm, Request, Rocket, State,
};
use rocket_dyn_templates::Template;
use serde::Deserialize;
@@ -20,7 +21,6 @@ use sqlx::SqlitePool;
use tera::Context;
use crate::{
SCHECKBUCH,
model::{
logbook::Logbook,
notification::Notification,
@@ -28,6 +28,7 @@ use crate::{
role::Role,
user::{User, UserWithDetails},
},
SCHECKBUCH,
};
pub(crate) mod admin;
@@ -330,13 +331,11 @@ mod test {
assert_eq!(response.status(), Status::Ok);
assert!(
response
.into_string()
.await
.unwrap()
.contains("Ruderassistent")
);
assert!(response
.into_string()
.await
.unwrap()
.contains("Ruderassistent"));
}
#[sqlx::test]

View File

@@ -15,10 +15,7 @@
class="link-primary">Überblick der Challenges</a>
</li>
<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
<li class="py-1">
Montag &rarr; gemeinsames Training; bitte um <a href="/planned" class="link-primary">Anmeldung</a>, damit jeder einen Ergo hat
</li>
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">
<a href="https://data.ergochallenge.at"
target="_blank"
@@ -194,7 +191,7 @@
</div>
</details>
</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">
<h2 class="h2">Update</h2>
<details class="p-2">
@@ -233,6 +230,14 @@
</ol>
</div>
</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>
{% endif %}