Compare commits
9 Commits
mb-npm-cho
...
5ec457fea7
Author | SHA1 | Date | |
---|---|---|---|
5ec457fea7 | |||
4fcd34cfa9 | |||
d64f6f61ba | |||
5934bbe666 | |||
b7cc01ff1c | |||
e9a78db048 | |||
0996a81d52 | |||
25df7a935c | |||
![]() |
55c0647b55 |
@@ -25,15 +25,15 @@ jobs:
|
|||||||
cargo build
|
cargo build
|
||||||
cd frontend && npm install && npm run build
|
cd frontend && npm install && npm run build
|
||||||
- name: Frontend tests
|
- name: Frontend tests
|
||||||
run: cd frontend && npx playwright install && npx playwright test --workers 1 --reporter line
|
run: cd frontend && npx playwright install && npx playwright test --workers 1 --reporter html,line
|
||||||
|
- uses: actions/upload-artifact@v3
|
||||||
|
if: always()
|
||||||
|
with:
|
||||||
|
name: playwright-report
|
||||||
|
path: frontend/playwright-report/
|
||||||
|
retention-days: 30
|
||||||
- name: Backend tests
|
- name: Backend tests
|
||||||
run: cargo test --verbose
|
run: cargo test --verbose
|
||||||
#- uses: actions/upload-artifact@v3
|
|
||||||
# if: always()
|
|
||||||
# with:
|
|
||||||
# name: playwright-report
|
|
||||||
# path: frontend/playwright-report/
|
|
||||||
# retention-days: 30
|
|
||||||
|
|
||||||
deploy-staging:
|
deploy-staging:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@@ -413,7 +413,7 @@ function initNewChoice(select: HTMLInputElement) {
|
|||||||
steering_person.setAttribute("required", "required");
|
steering_person.setAttribute("required", "required");
|
||||||
}
|
}
|
||||||
const choice = new Choices(select, {
|
const choice = new Choices(select, {
|
||||||
searchResultLimit: -1,
|
searchResultLimit: 100,
|
||||||
searchFields: ["label", "value", "customProperties.searchableText"],
|
searchFields: ["label", "value", "customProperties.searchableText"],
|
||||||
removeItemButton: true,
|
removeItemButton: true,
|
||||||
loadingText: "Wird geladen...",
|
loadingText: "Wird geladen...",
|
||||||
@@ -426,7 +426,6 @@ function initNewChoice(select: HTMLInputElement) {
|
|||||||
return `Nur ${maxItemCount} Ruderer können hinzugefügt werden`;
|
return `Nur ${maxItemCount} Ruderer können hinzugefügt werden`;
|
||||||
},
|
},
|
||||||
callbackOnInit: function () {
|
callbackOnInit: function () {
|
||||||
console.log(this);
|
|
||||||
this._currentState.items.forEach(function (obj) {
|
this._currentState.items.forEach(function (obj) {
|
||||||
if (boat_in_ottensheim && obj.customProperties) {
|
if (boat_in_ottensheim && obj.customProperties) {
|
||||||
if (obj.customProperties.is_racing) {
|
if (obj.customProperties.is_racing) {
|
||||||
|
@@ -21,7 +21,7 @@
|
|||||||
"vite-plugin-static-copy": "^0.13.1"
|
"vite-plugin-static-copy": "^0.13.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"choices.js": "^11.1.0",
|
"choices.js": "^10.2.0",
|
||||||
"d3": "^7.8.5",
|
"d3": "^7.8.5",
|
||||||
"terser": "^5.21.0"
|
"terser": "^5.21.0"
|
||||||
}
|
}
|
||||||
|
6
package-lock.json
generated
Normal file
6
package-lock.json
generated
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"name": "rowt",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {}
|
||||||
|
}
|
@@ -8,7 +8,7 @@ use crate::model::{
|
|||||||
notification::Notification,
|
notification::Notification,
|
||||||
role::Role,
|
role::Role,
|
||||||
};
|
};
|
||||||
use chrono::NaiveDate;
|
use chrono::{Datelike, Local, NaiveDate};
|
||||||
use rocket::{fs::TempFile, tokio::io::AsyncReadExt};
|
use rocket::{fs::TempFile, tokio::io::AsyncReadExt};
|
||||||
use sqlx::SqlitePool;
|
use sqlx::SqlitePool;
|
||||||
|
|
||||||
@@ -578,4 +578,32 @@ impl User {
|
|||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub(crate) async fn has_to_pay_einschreibgebuehr_this_year(&self, db: &SqlitePool) -> bool {
|
||||||
|
if !self.has_role(db, "schnupperant").await {
|
||||||
|
if let Some(member_since_date) = &self.member_since_date {
|
||||||
|
if let Ok(member_since_date) =
|
||||||
|
NaiveDate::parse_from_str(member_since_date, "%Y-%m-%d")
|
||||||
|
{
|
||||||
|
if member_since_date.year() == Local::now().year()
|
||||||
|
&& !self.has_role(db, "no-einschreibgebuehr").await
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
false
|
||||||
|
}
|
||||||
|
pub(crate) fn has_to_pay_only_half(&self) -> bool {
|
||||||
|
if let Some(member_since_date) = &self.member_since_date {
|
||||||
|
if let Ok(member_since_date) = NaiveDate::parse_from_str(member_since_date, "%Y-%m-%d")
|
||||||
|
{
|
||||||
|
let halfprice_startdate =
|
||||||
|
NaiveDate::from_ymd_opt(Local::now().year(), 7, 1).unwrap();
|
||||||
|
return member_since_date >= halfprice_startdate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,10 +1,9 @@
|
|||||||
use super::User;
|
use super::User;
|
||||||
use crate::{
|
use crate::{
|
||||||
BOAT_STORAGE, DUAL_MEMBERSHIP, EINSCHREIBGEBUEHR, FAMILY_THREE_OR_MORE, FAMILY_TWO, FOERDERND,
|
model::family::Family, BOAT_STORAGE, DUAL_MEMBERSHIP, EINSCHREIBGEBUEHR, FAMILY_THREE_OR_MORE,
|
||||||
REGULAR, RENNRUDERBEITRAG, SCHECKBUCH, STUDENT_OR_PUPIL, TRIAL_ROWING, TRIAL_ROWING_REDUCED,
|
FAMILY_TWO, FOERDERND, REGULAR, RENNRUDERBEITRAG, SCHECKBUCH, STUDENT_OR_PUPIL, TRIAL_ROWING,
|
||||||
UNTERSTUETZEND, model::family::Family,
|
TRIAL_ROWING_REDUCED, UNTERSTUETZEND,
|
||||||
};
|
};
|
||||||
use chrono::{Datelike, Local, NaiveDate};
|
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use sqlx::SqlitePool;
|
use sqlx::SqlitePool;
|
||||||
|
|
||||||
@@ -81,30 +80,52 @@ impl User {
|
|||||||
let mut fee = Fee::new();
|
let mut fee = Fee::new();
|
||||||
|
|
||||||
if let Some(family) = Family::find_by_opt_id(db, self.family_id).await {
|
if let Some(family) = Family::find_by_opt_id(db, self.family_id).await {
|
||||||
|
let mut einschreibgebuehr = false;
|
||||||
|
let mut half_price = true;
|
||||||
for member in family.members(db).await {
|
for member in family.members(db).await {
|
||||||
fee.add_person(&member);
|
fee.add_person(&member);
|
||||||
if member.has_role(db, "paid").await {
|
if member.has_role(db, "paid").await {
|
||||||
fee.paid();
|
fee.paid();
|
||||||
}
|
}
|
||||||
fee.merge(member.fee_without_families(db).await);
|
fee.merge(member.fee_without_families(db, true).await);
|
||||||
|
if member.has_to_pay_einschreibgebuehr_this_year(db).await {
|
||||||
|
einschreibgebuehr = true;
|
||||||
|
}
|
||||||
|
if !member.has_to_pay_only_half() {
|
||||||
|
half_price = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if family.amount_family_members(db).await > 2 {
|
if family.amount_family_members(db).await > 2 {
|
||||||
fee.add("Familie 3+ Personen".into(), FAMILY_THREE_OR_MORE);
|
if half_price {
|
||||||
|
fee.add(
|
||||||
|
"Familie 3+ Personen (Halbpreis)".into(),
|
||||||
|
FAMILY_THREE_OR_MORE / 2,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
fee.add("Familie 3+ Personen".into(), FAMILY_THREE_OR_MORE);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
fee.add("Familie 2 Personen".into(), FAMILY_TWO);
|
if half_price {
|
||||||
|
fee.add("Familie 2 Personen (Halbpreis)".into(), FAMILY_TWO / 2);
|
||||||
|
} else {
|
||||||
|
fee.add("Familie 2 Personen".into(), FAMILY_TWO);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if einschreibgebuehr {
|
||||||
|
fee.add("Einschreibgebühr (Familie)".into(), EINSCHREIBGEBUEHR);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fee.add_person(self);
|
fee.add_person(self);
|
||||||
if self.has_role(db, "paid").await {
|
if self.has_role(db, "paid").await {
|
||||||
fee.paid();
|
fee.paid();
|
||||||
}
|
}
|
||||||
fee.merge(self.fee_without_families(db).await);
|
fee.merge(self.fee_without_families(db, false).await);
|
||||||
}
|
}
|
||||||
|
|
||||||
Some(fee)
|
Some(fee)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn fee_without_families(&self, db: &SqlitePool) -> Fee {
|
async fn fee_without_families(&self, db: &SqlitePool, entry_fee_paid_with_family: bool) -> Fee {
|
||||||
let mut fee = Fee::new();
|
let mut fee = Fee::new();
|
||||||
|
|
||||||
if !self.has_role(db, "Donau Linz").await
|
if !self.has_role(db, "Donau Linz").await
|
||||||
@@ -125,38 +146,24 @@ impl User {
|
|||||||
|
|
||||||
let amount_boats = self.amount_boats(db).await;
|
let amount_boats = self.amount_boats(db).await;
|
||||||
if amount_boats > 0 {
|
if amount_boats > 0 {
|
||||||
fee.add(
|
if self.has_to_pay_only_half() {
|
||||||
format!("{}x Bootsplatz", amount_boats),
|
fee.add(
|
||||||
amount_boats * BOAT_STORAGE,
|
format!("{}x Bootsplatz (Halbpreis)", amount_boats),
|
||||||
);
|
amount_boats * BOAT_STORAGE / 2,
|
||||||
}
|
);
|
||||||
|
} else {
|
||||||
if !self.has_role(db, "schnupperant").await {
|
fee.add(
|
||||||
if let Some(member_since_date) = &self.member_since_date {
|
format!("{}x Bootsplatz", amount_boats),
|
||||||
if let Ok(member_since_date) =
|
amount_boats * BOAT_STORAGE,
|
||||||
NaiveDate::parse_from_str(member_since_date, "%Y-%m-%d")
|
);
|
||||||
{
|
|
||||||
if member_since_date.year() == Local::now().year()
|
|
||||||
&& !self.has_role(db, "no-einschreibgebuehr").await
|
|
||||||
{
|
|
||||||
fee.add("Einschreibgebühr".into(), EINSCHREIBGEBUEHR);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let halfprice = if let Some(member_since_date) = &self.member_since_date {
|
if self.has_to_pay_einschreibgebuehr_this_year(db).await && !entry_fee_paid_with_family {
|
||||||
match NaiveDate::parse_from_str(member_since_date, "%Y-%m-%d") {
|
fee.add("Einschreibgebühr".into(), EINSCHREIBGEBUEHR);
|
||||||
Ok(member_since_date) => {
|
}
|
||||||
let halfprice_startdate =
|
|
||||||
NaiveDate::from_ymd_opt(Local::now().year(), 7, 1).unwrap();
|
let halfprice = self.has_to_pay_only_half();
|
||||||
member_since_date >= halfprice_startdate
|
|
||||||
}
|
|
||||||
Err(_) => false,
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
false
|
|
||||||
};
|
|
||||||
|
|
||||||
if self.has_role(db, "schnupperant").await {
|
if self.has_role(db, "schnupperant").await {
|
||||||
if self.has_role(db, "Student").await || self.has_role(db, "Schüler").await {
|
if self.has_role(db, "Student").await || self.has_role(db, "Schüler").await {
|
||||||
|
@@ -795,6 +795,7 @@ macro_rules! special_user {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl $name {
|
impl $name {
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn into_inner(self) -> User {
|
pub fn into_inner(self) -> User {
|
||||||
self.user
|
self.user
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user