update
This commit is contained in:
parent
a8dfe5f0e9
commit
37475460e2
5 changed files with 93 additions and 2 deletions
|
@ -239,6 +239,18 @@ impl Variant {
|
|||
.clone()
|
||||
}
|
||||
|
||||
/// Check if item variant is below minimum. Returns if this is the case and the number needed to fulfill minimum
|
||||
pub async fn is_below_min(&self) -> (bool, i64) {
|
||||
if let Some(min) = self.min {
|
||||
let amount = self.inventory().await.len() as i64;
|
||||
if amount < min {
|
||||
return (true, min - amount);
|
||||
}
|
||||
}
|
||||
|
||||
(false, 0)
|
||||
}
|
||||
|
||||
pub async fn stat(&self) -> serde_json::Value {
|
||||
let active_transactions = self.inventory().await;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue