Make recipe yield for grocery list a parameter

This commit is contained in:
Matteo Settenvini 2022-08-20 11:47:28 +02:00
parent 1d5faae1f6
commit b2a03ab080
Signed by: matteo
GPG key ID: 8576CC1AD97D42DF
2 changed files with 8 additions and 3 deletions

View file

@ -19,6 +19,7 @@ pub async fn with(
location: &str,
start_date: Option<NaiveDate>,
days: u32,
required_yield: f64,
) -> Result<()> {
use chrono::{NaiveDateTime, NaiveTime, TimeZone};
let start = start_date
@ -34,9 +35,7 @@ pub async fn with(
};
let ids = map_events_to_recipe_ids(api_client, calendar_name, &date_range).await?;
// TODO: make required_yield configurable!
let ingredients = get_ingredients(api_client, ids, 4.0).await?;
let ingredients = get_ingredients(api_client, ids, required_yield).await?;
let ingredients = merge_ingredients(ingredients);
let md = prepare_grocery_list(&date_range, &ingredients)?;
log::debug!("Saving the following grocery list:\n\n{}", &md);