This commit is contained in:
JMARyA 2024-09-27 09:19:32 +02:00
parent 58f5b1d93c
commit f074727130
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
6 changed files with 101 additions and 22 deletions

View file

@ -130,10 +130,11 @@ pub async fn inventory_route_variant(
}
/// Returns statistics for the Item Variant
#[get("/item/<item_id>/<variant_id>/stat")]
#[get("/item/<item_id>/<variant_id>/stat?<full>")]
pub async fn variant_stat_route(
item_id: &str,
variant_id: &str,
full: Option<&str>,
itemdb: &State<ItemDB>,
t: Token,
c: &State<Config>,
@ -146,5 +147,7 @@ pub async fn variant_stat_route(
.variant(variant_id)
.ok_or_else(variant_does_not_exist_error)?;
Ok(variant.stat().await)
Ok(variant
.stat(full.map(|x| x == "1" || x == "true").unwrap_or(false))
.await)
}