Compare commits

...

50 Commits

Author SHA1 Message Date
09aa0fc136 Merge pull request 'allow scheckbuch finances editing via /user/fees' (#1045) from consistent-user-management into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 15m13s
CI/CD Pipeline / deploy-staging (push) Successful in 7m46s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #1045
2025-05-17 16:35:57 +02:00
abd58766d8 allow scheckbuch finances editing via /user/fees
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-05-17 16:34:50 +02:00
cc9505ca1e Merge pull request 'dont-repeatedly-get-price' (#1043) from dont-repeatedly-get-price into staging
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
Reviewed-on: #1043
2025-05-17 16:24:00 +02:00
5202060e2f ernst + board got rowingbadge notification on every trip of ernst, bc last 'wanderfahrt' was removed
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-05-17 16:23:24 +02:00
129c90f1aa Merge pull request 'format & lanaguage improv' (#1042) from language-improvement into main
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: #1042
2025-05-17 15:59:58 +02:00
22f70f533a Merge pull request 'language-improvement' (#1041) from language-improvement into staging
Some checks failed
CI/CD Pipeline / test (push) Successful in 15m21s
CI/CD Pipeline / deploy-staging (push) Has been cancelled
CI/CD Pipeline / deploy-main (push) Has been cancelled
Reviewed-on: #1041
2025-05-17 15:59:51 +02:00
6df029b4a7 Merge pull request 'default duration in cal of trips with type Lange Ausfahrt -> 6 hrs (instead of 3); Fixes #939' (#1040) from longer-long-trips into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 15m39s
CI/CD Pipeline / deploy-staging (push) Successful in 7m41s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #1040
2025-05-17 10:08:58 +02:00
1d4d59842b Merge pull request 'nx-link' (#1037) from nx-link into staging
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
Reviewed-on: #1037
2025-05-17 09:55:22 +02:00
a63d29a42a Merge pull request 'more-activities' (#1035) from more-activities into staging
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
Reviewed-on: #1035
2025-05-17 09:50:01 +02:00
1f4ebc31ed Merge pull request 'use formatted_names in roles' (#1033) from format-roles into staging
Some checks failed
CI/CD Pipeline / test (push) Successful in 14m58s
CI/CD Pipeline / deploy-main (push) Has been cancelled
CI/CD Pipeline / deploy-staging (push) Has been cancelled
Reviewed-on: #1033
2025-05-17 09:13:43 +02:00
50cd3c2d75 Merge pull request 'already-in-db' (#1031) from already-in-db 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: #1031
2025-05-17 09:07:40 +02:00
0edd796f73 Merge pull request 'new-fee-structure' (#1028) from new-fee-structure into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 15m35s
CI/CD Pipeline / deploy-staging (push) Successful in 8m3s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #1028
2025-05-16 23:19:20 +02:00
e883c0e6e2 Merge pull request 'auto-update-both-branches' (#1025) from auto-update-both-branches into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 17m11s
CI/CD Pipeline / deploy-staging (push) Successful in 8m36s
CI/CD Pipeline / deploy-main (push) Has been skipped
Update Cargo Dependencies / update-dependencies (push) Successful in 1m10s
Reviewed-on: #1025
2025-05-15 22:26:24 +02:00
d2390ca5c2 Merge pull request 'fix/ci' (#1023) from fix/ci into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 16m21s
CI/CD Pipeline / deploy-staging (push) Successful in 7m52s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #1023
2025-05-14 23:45:29 +02:00
4906b757b8 Merge pull request 'improve logging' (#1021) from improve-logging into staging
Some checks failed
CI/CD Pipeline / test (push) Failing after 10m26s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #1021
2025-05-14 23:01:12 +02:00
0b62f59d19 Merge pull request 'add auto-update; Progress at #503' (#1019) from auto-update into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 13m56s
CI/CD Pipeline / deploy-staging (push) Successful in 22m28s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #1019
2025-05-14 08:31:42 +02:00
924683511c Merge pull request 'nicer-notes' (#1016) from nicer-notes 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: #1016
2025-05-14 08:15:46 +02:00
d7d6eb2b43 Merge pull request 'start replacing activitybuilder' (#1014) from acitvities-adaption into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 18m10s
CI/CD Pipeline / deploy-staging (push) Successful in 8m37s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #1014
2025-05-12 23:09:27 +02:00
4859890389 Merge pull request 'prepare to remove old log, in favor of activities' (#1012) from acitvities-adaption into staging
Some checks failed
CI/CD Pipeline / test (push) Successful in 17m57s
CI/CD Pipeline / deploy-staging (push) Has been cancelled
CI/CD Pipeline / deploy-main (push) Has been cancelled
Reviewed-on: #1012
2025-05-12 22:32:04 +02:00
4f34cc180c Merge pull request 'clean-backend-code' (#1008) from clean-backend-code into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 17m23s
CI/CD Pipeline / deploy-staging (push) Successful in 9m43s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #1008
2025-05-11 20:55:49 +02:00
3c26381901 Merge pull request 'fix-notification' (#1006) from fix-notification into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 16m6s
CI/CD Pipeline / deploy-staging (push) Successful in 8m22s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #1006
2025-05-10 15:48:34 +02:00
e01f9806bd Merge pull request 'inform new cox about things' (#1003) from informat-new-cox into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 16m25s
CI/CD Pipeline / deploy-staging (push) Successful in 8m17s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #1003
2025-05-09 13:05:31 +02:00
71087af0df Merge pull request 'remove-notes' (#1001) from remove-notes into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 18m4s
CI/CD Pipeline / deploy-staging (push) Successful in 9m50s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #1001
2025-05-09 08:45:15 +02:00
6efcaaccf9 Merge pull request 'show-all-activities' (#999) from show-all-activities into staging
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
Reviewed-on: #999
2025-05-09 08:32:14 +02:00
60578dfaba Merge pull request 'fix-diamond-text' (#997) from fix-diamond-text into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 15m37s
CI/CD Pipeline / deploy-staging (push) Successful in 9m29s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #997
2025-05-07 13:44:43 +02:00
addf0f437b Merge pull request 'improve-role-view' (#995) from improve-role-view into staging
Some checks failed
CI/CD Pipeline / test (push) Successful in 15m40s
CI/CD Pipeline / deploy-main (push) Has been cancelled
CI/CD Pipeline / deploy-staging (push) Has been cancelled
Reviewed-on: #995
2025-05-07 13:06:33 +02:00
51df7f2d1e Merge pull request 'upd' (#993) from upd into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 30m10s
CI/CD Pipeline / deploy-staging (push) Successful in 24m9s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #993
2025-05-06 22:51:06 +02:00
78faf1b0db Merge pull request 'single-user-edit-page' (#991) from single-user-edit-page into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 15m12s
CI/CD Pipeline / deploy-staging (push) Successful in 7m17s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #991
2025-05-06 13:40:59 +02:00
e3fc756b3f Merge pull request 'single-user-edit-page' (#990) from single-user-edit-page into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 14m43s
CI/CD Pipeline / deploy-staging (push) Successful in 13m5s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #990
2025-05-06 10:14:55 +02:00
7083d27644 Merge pull request 'single-user-edit-page' (#986) from single-user-edit-page into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 16m24s
CI/CD Pipeline / deploy-staging (push) Successful in 8m23s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #986
2025-05-05 20:37:12 +02:00
8277ef6af8 Merge pull request 'allow to create users' (#978) from single-user-edit-page into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 14m29s
CI/CD Pipeline / deploy-staging (push) Successful in 7m14s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #978
2025-05-05 12:05:47 +02:00
67d5df9c18 Merge pull request 'Fill acitivites from various activities; Fixes #972' (#977) from single-user-edit-page into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 15m29s
CI/CD Pipeline / deploy-staging (push) Successful in 7m49s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #977
2025-05-04 19:05:38 +02:00
3ffc44a5a2 Merge pull request 'single-user-edit-page' (#975) from single-user-edit-page into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 15m18s
CI/CD Pipeline / deploy-staging (push) Successful in 7m57s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #975
2025-05-04 10:48:41 +02:00
bd2686fa9c Merge pull request 'add notes' (#973) from single-user-edit-page into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 14m2s
CI/CD Pipeline / deploy-staging (push) Successful in 7m5s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #973
2025-05-03 21:37:31 +02:00
495ee666cd Merge pull request 'single-user-edit-page' (#971) from single-user-edit-page into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 15m33s
CI/CD Pipeline / deploy-staging (push) Successful in 7m46s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #971
2025-05-03 19:20:17 +02:00
5296b6a6c1 Merge pull request 'single-user-edit-page' (#970) from single-user-edit-page into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 13m54s
CI/CD Pipeline / deploy-staging (push) Successful in 7m8s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #970
2025-05-03 13:46:39 +02:00
49e657ab54 Merge pull request 'single-user-edit-page' (#968) from single-user-edit-page into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 13m27s
CI/CD Pipeline / deploy-staging (push) Successful in 6m34s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #968
2025-05-02 18:16:53 +02:00
25bbaca0d3 Merge pull request 'show payment status in user view; Fixes #965' (#967) from single-user-edit-page into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 14m54s
CI/CD Pipeline / deploy-staging (push) Successful in 8m6s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #967
2025-04-30 23:32:36 +02:00
26038eabe4 Merge pull request 'single-user-edit-page' (#966) from single-user-edit-page into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 14m39s
CI/CD Pipeline / deploy-staging (push) Successful in 7m3s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #966
2025-04-30 22:32:46 +02:00
57acd92e7c Merge pull request 'fix-list-scheckbuch' (#960) from fix-list-scheckbuch into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 14m37s
CI/CD Pipeline / deploy-staging (push) Successful in 7m3s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #960
2025-04-29 23:01:50 +02:00
c136c60e62 Merge pull request 'separate-scheckbuch-user' (#948) from separate-scheckbuch-user into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 14m17s
CI/CD Pipeline / deploy-staging (push) Successful in 6m45s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #948
2025-04-29 21:06:00 +02:00
a5e90ea014 Merge pull request 'log-event-updates' (#946) from log-event-updates into staging
Some checks failed
CI/CD Pipeline / test (push) Failing after 10m29s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #946
2025-04-29 20:37:11 +02:00
f0f3909239 Merge pull request 'format-cal-according-to-standard' (#944) from format-cal-according-to-standard into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 14m35s
CI/CD Pipeline / deploy-staging (push) Successful in 21m47s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #944
2025-04-28 22:20:39 +02:00
1438bbe3a8 Merge pull request 'hide-box' (#935) from hide-box into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 16m53s
CI/CD Pipeline / deploy-staging (push) Successful in 7m59s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #935
2025-04-19 21:30:20 +02:00
a910cd745d Merge pull request 'document nextcloud integration, for future nextcloud setups' (#933) from doc-nextcloud-integration into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 15m47s
CI/CD Pipeline / deploy-staging (push) Successful in 7m25s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #933
2025-04-19 09:19:58 +02:00
6265440288 Merge pull request 'zero-rower-events' (#931) from zero-rower-events into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 16m10s
CI/CD Pipeline / deploy-staging (push) Successful in 7m42s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #931
2025-04-19 00:22:27 +02:00
3baed66ebc Merge pull request 'also be able to cancel trips (not only events)' (#929) from zero-rower-events into staging
Some checks failed
CI/CD Pipeline / test (push) Failing after 13m39s
CI/CD Pipeline / deploy-staging (push) Has been skipped
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #929
2025-04-18 23:32:34 +02:00
499ce06438 Merge pull request 'zero-rower-events; Fixes #913' (#927) from zero-rower-events into staging
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
Reviewed-on: #927
2025-04-18 23:12:41 +02:00
67e5277c62 Merge pull request 'remove unused dep; cargo clippy' (#925) from simple-nx-auth into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 15m20s
CI/CD Pipeline / deploy-staging (push) Successful in 7m38s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #925
2025-04-18 17:45:44 +02:00
ce154bf060 Merge pull request 'simple-nx-auth' (#923) from simple-nx-auth into staging
All checks were successful
CI/CD Pipeline / test (push) Successful in 16m3s
CI/CD Pipeline / deploy-staging (push) Successful in 7m41s
CI/CD Pipeline / deploy-main (push) Has been skipped
Reviewed-on: #923
2025-04-18 17:10:44 +02:00
5 changed files with 45 additions and 49 deletions

View File

@ -367,7 +367,6 @@ ORDER BY departure DESC
min_distance: i32,
year: i32,
filter: Filter,
exclude_last_log: bool,
) -> Vec<LogbookWithBoatAndRowers> {
let logs: Vec<Logbook> = sqlx::query_as(
&format!("
@ -399,9 +398,6 @@ ORDER BY departure DESC
}
}
}
if exclude_last_log {
ret.pop();
}
ret
}

View File

@ -1,9 +1,9 @@
use std::{error::Error, fs};
use lettre::{
Address, Message, SmtpTransport, Transport,
message::{Attachment, MultiPart, SinglePart, header::ContentType},
message::{header::ContentType, Attachment, MultiPart, SinglePart},
transport::smtp::authentication::Credentials,
Address, Message, SmtpTransport, Transport,
};
use sqlx::{Sqlite, SqlitePool, Transaction};
@ -162,7 +162,7 @@ impl Mail {
}
}
if user.has_role(db, "schnupperant").await {
if user.has_role(db, "schnupperant").await || user.has_role(db, "scheckbuch").await {
continue;
}
@ -279,7 +279,7 @@ Der Vorstand");
}
}
if user.has_role(db, "schnupperant").await {
if user.has_role(db, "schnupperant").await || user.has_role(db, "scheckbuch").await {
continue;
}

View File

@ -2,7 +2,7 @@ use std::cmp;
use chrono::{Datelike, Local, NaiveDate};
use serde::Serialize;
use sqlx::{Sqlite, SqlitePool, Transaction};
use sqlx::{Acquire, Sqlite, SqlitePool, Transaction};
use crate::model::{
logbook::{Filter, Logbook, LogbookWithBoatAndRowers},
@ -141,11 +141,7 @@ impl Status {
}
}
pub(crate) async fn for_user_tx(
db: &mut Transaction<'_, Sqlite>,
user: &User,
exclude_last_log: bool,
) -> Option<Self> {
pub(crate) async fn for_user_tx(db: &mut Transaction<'_, Sqlite>, user: &User) -> Option<Self> {
let Ok(agebracket) = AgeBracket::try_from(user) else {
return None;
};
@ -164,7 +160,6 @@ impl Status {
agebracket.required_dist_single_day_in_km(),
year,
Filter::SingleDayOnly,
exclude_last_log,
)
.await;
let multi_day_trips_over_required_distance =
@ -174,7 +169,6 @@ impl Status {
agebracket.required_dist_multi_day_in_km(),
year,
Filter::MultiDayOnly,
exclude_last_log,
)
.await;
@ -195,7 +189,7 @@ impl Status {
pub(crate) async fn for_user(db: &SqlitePool, user: &User) -> Option<Self> {
let mut tx = db.begin().await.unwrap();
let ret = Self::for_user_tx(&mut tx, user, false).await;
let ret = Self::for_user_tx(&mut tx, user).await;
tx.commit().await.unwrap();
ret
}
@ -204,11 +198,19 @@ impl Status {
db: &mut Transaction<'_, Sqlite>,
user: &User,
) -> bool {
if let Some(status) = Self::for_user_tx(db, user, false).await {
if let Some(status) = Self::for_user_tx(db, user).await {
// if user has agebracket...
if status.achieved {
// ... and has achieved the 'Fahrtenabzeichen'
let without_last_entry = Self::for_user_tx(db, user, true).await.unwrap();
let mut without_last = db.begin().await.unwrap();
let last = Logbook::completed_with_user_tx(&mut without_last, user).await;
let last = last.last().unwrap();
sqlx::query!("DELETE FROM logbook WHERE id=?", last.logbook.id)
.execute(&mut *without_last)
.await
.unwrap(); //Okay, because we can only create a Logbook of a valid id
let without_last_entry = Self::for_user_tx(&mut without_last, user).await.unwrap();
if !without_last_entry.achieved {
// ... and this wasn't the case before the last logentry
return true;

View File

@ -1,8 +1,8 @@
use super::User;
use crate::{
BOAT_STORAGE, DUAL_MEMBERSHIP, EINSCHREIBGEBUEHR, FAMILY_THREE_OR_MORE, FAMILY_TWO, FOERDERND,
REGULAR, RENNRUDERBEITRAG, STUDENT_OR_PUPIL, TRIAL_ROWING, TRIAL_ROWING_REDUCED,
UNTERSTUETZEND, model::family::Family,
model::family::Family, BOAT_STORAGE, DUAL_MEMBERSHIP, EINSCHREIBGEBUEHR, FAMILY_THREE_OR_MORE,
FAMILY_TWO, FOERDERND, REGULAR, RENNRUDERBEITRAG, SCHECKBUCH, STUDENT_OR_PUPIL, TRIAL_ROWING,
TRIAL_ROWING_REDUCED, UNTERSTUETZEND,
};
use chrono::{Datelike, Local, NaiveDate};
use serde::Serialize;
@ -70,6 +70,7 @@ impl User {
&& !self.has_role(db, "Unterstützend").await
&& !self.has_role(db, "Förderndes Mitglied").await
&& !self.has_role(db, "schnupperant").await
&& !self.has_role(db, "scheckbuch").await
{
return None;
}
@ -110,6 +111,7 @@ impl User {
&& !self.has_role(db, "Unterstützend").await
&& !self.has_role(db, "Förderndes Mitglied").await
&& !self.has_role(db, "schnupperant").await
&& !self.has_role(db, "scheckbuch").await
{
return fee;
}
@ -162,6 +164,8 @@ impl User {
} else {
fee.add("Schnupperkurs".into(), TRIAL_ROWING);
}
} else if self.has_role(db, "scheckbuch").await {
fee.add("Scheckbuch".into(), SCHECKBUCH);
} else if self.has_role(db, "Unterstützend").await {
fee.add("Unterstützendes Mitglied".into(), UNTERSTUETZEND);
} else if self.has_role(db, "Förderndes Mitglied").await {

View File

@ -1,21 +1,20 @@
use std::{fmt::Display, ops::DerefMut};
use argon2::{Argon2, PasswordHasher, password_hash::SaltString};
use argon2::{password_hash::SaltString, Argon2, PasswordHasher};
use chrono::{Datelike, Local, NaiveDate};
use log::info;
use rocket::async_trait;
use rocket::{
Request,
http::{Cookie, Status},
request::{FromRequest, Outcome},
time::{Duration, OffsetDateTime},
Request,
};
use serde::{Deserialize, Serialize};
use sqlx::{FromRow, Sqlite, SqlitePool, Transaction};
use super::activity::{ActivityBuilder, ReasonAuth};
use super::{
Day,
log::Log,
logbook::Logbook,
mail::Mail,
@ -24,6 +23,7 @@ use super::{
role::Role,
stat::Stat,
tripdetails::TripDetails,
Day,
};
use crate::AMOUNT_DAYS_TO_SHOW_TRIPS_AHEAD;
use scheckbuch::ScheckbuchUser;
@ -487,7 +487,7 @@ ASKÖ Ruderverein Donau Linz", self.name),
.save(db)
.await;
return Err(LoginError::InvalidAuthenticationCombo); //User existed sometime ago; has
//been deleted
//been deleted
}
if let Some(user_pw) = user.pw.as_ref() {
@ -590,9 +590,9 @@ ASKÖ Ruderverein Donau Linz", self.name),
pub(crate) async fn amount_days_to_show(&self, db: &SqlitePool) -> i64 {
if self.allowed_to_steer(db).await {
let end_of_year = NaiveDate::from_ymd_opt(Local::now().year(), 12, 31).unwrap(); //Ok,
//december
//has 31
//days
//december
//has 31
//days
let days_left_in_year = end_of_year
.signed_duration_since(Local::now().date_naive())
.num_days()
@ -601,9 +601,9 @@ ASKÖ Ruderverein Donau Linz", self.name),
if days_left_in_year <= 31 {
let end_of_next_year =
NaiveDate::from_ymd_opt(Local::now().year() + 1, 12, 31).unwrap(); //Ok,
//december
//has 31
//days
//december
//has 31
//days
end_of_next_year
.signed_duration_since(Local::now().date_naive())
.num_days()
@ -835,8 +835,8 @@ special_user!(SteeringUser, +"cox", +"Bootsführer");
special_user!(AdminUser, +"admin");
special_user!(AllowedForPlannedTripsUser, +"Donau Linz", +"scheckbuch", +"Förderndes Mitglied");
special_user!(DonauLinzUser, +"Donau Linz", -"Unterstützend", -"Förderndes Mitglied"); // TODO:
// remove ->
// RegularUser
// remove ->
// RegularUser
special_user!(SchnupperBetreuerUser, +"schnupper-betreuer");
special_user!(VorstandUser, +"admin", +"Vorstand");
special_user!(EventUser, +"manage_events");
@ -950,21 +950,17 @@ mod test {
#[sqlx::test]
fn wrong_pw() {
let pool = testdb!();
assert!(
User::login(&pool, "admin".into(), "admi".into())
.await
.is_err()
);
assert!(User::login(&pool, "admin".into(), "admi".into())
.await
.is_err());
}
#[sqlx::test]
fn wrong_username() {
let pool = testdb!();
assert!(
User::login(&pool, "admi".into(), "admin".into())
.await
.is_err()
);
assert!(User::login(&pool, "admi".into(), "admin".into())
.await
.is_err());
}
#[sqlx::test]
@ -984,11 +980,9 @@ mod test {
let pool = testdb!();
let user = User::find_by_id(&pool, 1).await.unwrap();
assert!(
User::login(&pool, "admin".into(), "abc".into())
.await
.is_err()
);
assert!(User::login(&pool, "admin".into(), "abc".into())
.await
.is_err());
user.update_pw(&pool, "abc".into()).await;