chore: conform linting
parent
c33cec3af5
commit
7467b1f588
|
@ -50,25 +50,20 @@ pub async fn available(ctx: Context<'_>, date: HumanNaiveDate) -> Result<(), Err
|
||||||
let client = &ctx.data().client;
|
let client = &ctx.data().client;
|
||||||
let date: NaiveDate = date.into();
|
let date: NaiveDate = date.into();
|
||||||
|
|
||||||
let mut resources = client
|
let mut resources = client.available(STERRE_BIB_ID, date, 1).await?;
|
||||||
.available(STERRE_BIB_ID, date, 1)
|
|
||||||
.await?;
|
|
||||||
// Cloning here isn't super efficient, but this list only consists of a handful of elements so
|
// Cloning here isn't super efficient, but this list only consists of a handful of elements so
|
||||||
// it's fine
|
// it's fine
|
||||||
resources.sort_by_key(|k| k.resource_name.clone());
|
resources.sort_by_key(|k| k.resource_name.clone());
|
||||||
|
|
||||||
ctx.send(|f| {
|
ctx.send(|f| {
|
||||||
f.embed(|e| {
|
f.embed(|e| {
|
||||||
e.description(format!(
|
e.description(format!("Available booking dates for {}.", date))
|
||||||
"Available booking dates for {}.",
|
.fields(
|
||||||
date
|
resources
|
||||||
))
|
.into_iter()
|
||||||
.fields(
|
.map(resource_to_embed_field)
|
||||||
resources
|
.collect::<Vec<EmbedField>>(),
|
||||||
.into_iter()
|
)
|
||||||
.map(resource_to_embed_field)
|
|
||||||
.collect::<Vec<EmbedField>>(),
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.await?;
|
.await?;
|
||||||
|
@ -110,9 +105,7 @@ pub async fn book(
|
||||||
let user = user.unwrap();
|
let user = user.unwrap();
|
||||||
|
|
||||||
let client = &ctx.data().client;
|
let client = &ctx.data().client;
|
||||||
let resources = client
|
let resources = client.available(STERRE_BIB_ID, date, 1).await?;
|
||||||
.available(STERRE_BIB_ID, date, 1)
|
|
||||||
.await?;
|
|
||||||
let chosen_resource = resources
|
let chosen_resource = resources
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|r| capacity.is_none() || capacity.unwrap() <= r.capacity)
|
.filter(|r| capacity.is_none() || capacity.unwrap() <= r.capacity)
|
||||||
|
|
Loading…
Reference in New Issue