update
This commit is contained in:
parent
0be7fff77d
commit
74b07a0ea3
8 changed files with 107 additions and 10 deletions
|
@ -128,6 +128,18 @@ impl Variant {
|
|||
t._id
|
||||
}
|
||||
|
||||
pub async fn stat(&self) -> serde_json::Value {
|
||||
let active_transactions = self.inventory().await;
|
||||
|
||||
// fix : ignores currency
|
||||
let total_price: f64 = active_transactions.iter().map(|x| x.price.value).sum();
|
||||
|
||||
json!({
|
||||
"amount": active_transactions.len(),
|
||||
"total_price": total_price
|
||||
})
|
||||
}
|
||||
|
||||
pub fn api_json(&self) -> serde_json::Value {
|
||||
json!({
|
||||
"item": self.item,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue