remove donau linz stuff
Some checks failed
CI/CD Pipeline / deploy-main (push) Blocked by required conditions
CI/CD Pipeline / test (push) Has been cancelled

This commit is contained in:
Philipp Hofer 2024-12-11 21:49:54 +01:00
parent 2ec6e61578
commit 7a945c11e3
5 changed files with 20 additions and 57 deletions

View File

@ -232,10 +232,8 @@ WHERE trip_details.id=?
}
async fn advertise(db: &SqlitePool, day: &str, planned_starting_time: &str, name: &str) {
let donau = Role::find_by_name(db, "Donau Linz").await.unwrap();
Notification::create_for_role(
Notification::create_for_all(
db,
&donau,
&format!("Am {} um {} wurde ein neues Event angelegt: {} Wir freuen uns wenn du dabei mitmachst, die Anmeldung ist ab sofort offen :-)", day, planned_starting_time, name),
"Neues Event",
Some(&format!("/planned#{day}")),

View File

@ -89,6 +89,20 @@ impl Notification {
tx.commit().await.unwrap();
}
pub async fn create_for_all(
db: &SqlitePool,
message: &str,
category: &str,
link: Option<&str>,
action_after_reading: Option<&str>,
) {
let users = User::all(db).await;
for user in users {
Self::create(db, &user, message, category, link, action_after_reading).await;
}
}
pub async fn create_for_steering_people_tx(
db: &mut Transaction<'_, Sqlite>,
message: &str,

View File

@ -7,10 +7,7 @@ use crate::model::{event::Event, trip::Trip, user::User};
pub(crate) async fn get_personal_cal(db: &SqlitePool, user: &User) -> String {
let mut calendar = ICalendar::new("2.0", "ics-rs");
calendar.push(Property::new(
"X-WR-CALNAME",
"Donau Linz - Deine Ausfahrten",
));
calendar.push(Property::new("X-WR-CALNAME", "ruad.at - Deine Ausfahrten"));
let events = Event::all_with_user(db, user).await;
for event in events {

View File

@ -1,10 +1,8 @@
use csv::ReaderBuilder;
use rocket::{form::Form, get, post, routes, FromForm, Route, State};
use rocket_dyn_templates::{context, Template};
use rocket::{get, routes, Route, State};
use sqlx::SqlitePool;
use super::notification;
use crate::model::{log::Log, role::Role, user::AdminUser};
use crate::model::{log::Log, user::AdminUser};
pub mod event;
pub mod user;
@ -14,55 +12,11 @@ async fn log(db: &State<SqlitePool>, _admin: AdminUser) -> String {
Log::show(db).await
}
#[get("/list")]
async fn show_list(_admin: AdminUser) -> Template {
Template::render("admin/list/index", context!())
}
#[derive(FromForm)]
struct ListForm {
list: String,
}
#[post("/list", data = "<list_form>")]
async fn list(db: &State<SqlitePool>, _admin: AdminUser, list_form: Form<ListForm>) -> Template {
let role = Role::find_by_name(db, "Donau Linz").await.unwrap();
let acceptable_users = role.names_from_role(db).await;
let mut rdr = ReaderBuilder::new()
.has_headers(true)
.delimiter(b';')
.from_reader(list_form.list.trim().as_bytes());
let mut names_not_in_acceptable_users = Vec::new();
for result in rdr.records() {
println!("{result:?}");
let record = result.unwrap();
// Concatenate Vorname and Nachname
let vorname = record.get(2).unwrap_or_default().trim();
let nachname = record.get(3).unwrap_or_default().trim();
let full_name = format!("{} {}", vorname, nachname);
// Check if the concatenated name is not in the acceptable_users vector
if !acceptable_users.contains(&full_name) {
names_not_in_acceptable_users.push(full_name);
}
}
let context = context! {
result: names_not_in_acceptable_users
};
Template::render("admin/list/result", context)
}
pub fn routes() -> Vec<Route> {
let mut ret = Vec::new();
ret.append(&mut user::routes());
ret.append(&mut notification::routes());
ret.append(&mut event::routes());
ret.append(&mut routes![log, show_list, list]);
ret.append(&mut routes![log]);
ret
}

View File

@ -20,7 +20,7 @@
<link rel="manifest" href="/public/images/site.webmanifest">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff">
<title>Ruderassistent - ASKÖ Ruderverein Donau Linz</title>
<title>Ruderassistent - ruad.at</title>
</head>
<body class="bg-gray-100 dark:bg-black">
{% if loggedin_user %}{{ macros::header(loggedin_user=loggedin_user) }}{% endif %}