feat: export events german weekday and decimal comma

This commit is contained in:
Max Hohlfeld 2025-07-14 15:06:58 +02:00
parent e540844dcd
commit 10841d493f

View File

@ -1,7 +1,7 @@
use actix_http::header::CONTENT_DISPOSITION;
use actix_web::{http::header::ContentDisposition, web, HttpResponse, Responder};
use brass_db::models::{ExportEventRow, Function, Role, SimpleAssignment, User};
use chrono::{Datelike, NaiveDate};
use chrono::{Locale, NaiveDate};
use rust_xlsxwriter::workbook::Workbook;
use serde::Deserialize;
use sqlx::PgPool;
@ -37,7 +37,11 @@ fn read(rows: Vec<ExportEventRow>) -> Vec<EventExportEntry> {
.start_timestamp
.format(DateTimeFormat::DayMonthYear.into())
.to_string(),
weekday: r.start_timestamp.weekday().to_string(),
weekday: r
.start_timestamp
.date()
.format_localized("%A", Locale::de_DE)
.to_string(),
start_time: r
.start_timestamp
.time()
@ -164,7 +168,7 @@ pub async fn get(
worksheet.write(i, 3, &entry.end_time).unwrap();
worksheet.write(i, 4, entry.hours).unwrap();
worksheet
.write(i, 4, format!("{:.1}", entry.hours))
.write(i, 4, format!("{:.1}", entry.hours).replace('.', ","))
.unwrap();
worksheet.write(i, 5, &entry.location).unwrap();
worksheet.write(i, 6, &entry.name).unwrap();