Add default servings to profile + choose servings when scheduling

This commit is contained in:
Greg Burri 2025-02-03 23:42:07 +01:00
parent d8641d4db6
commit ae6da1a5ae
13 changed files with 70 additions and 34 deletions

View file

@ -655,6 +655,7 @@ pub async fn edit_user_get(
ProfileTemplate {
username: &user.name,
email: &user.email,
default_servings: user.default_servings,
message: "",
message_email: "",
message_password: "",
@ -673,6 +674,7 @@ pub async fn edit_user_get(
pub struct EditUserForm {
name: String,
email: String,
default_servings: u32,
password_1: String,
password_2: String,
}
@ -712,6 +714,7 @@ pub async fn edit_user_post(
user: Some(user),
username: &form_data.name,
email: &form_data.email,
default_servings: form_data.default_servings,
message_email: match error {
ProfileUpdateError::InvalidEmail => tr.t(Sentence::InvalidEmail),
ProfileUpdateError::EmailAlreadyTaken => tr.t(Sentence::EmailAlreadyTaken),
@ -760,6 +763,7 @@ pub async fn edit_user_post(
user.id,
Some(email_trimmed),
Some(&form_data.name),
Some(form_data.default_servings),
new_password,
)
.await
@ -815,6 +819,7 @@ pub async fn edit_user_post(
user,
username: &form_data.name,
email: &form_data.email,
default_servings: form_data.default_servings,
message,
message_email: "",
message_password: "",