mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 14:22:40 +01:00
fixes to computed goal result
This commit is contained in:
parent
bfec722312
commit
92a2bb4d32
3 changed files with 16 additions and 13 deletions
|
@ -131,12 +131,12 @@ namespace BTCPayServer.Hubs
|
|||
RateFetcher rateFetcher, RateRules rateRules)
|
||||
{
|
||||
decimal result = 0;
|
||||
|
||||
var groupingByCurrency = invoices.GroupBy(entity => entity.ProductInformation.Currency);
|
||||
|
||||
var stats = GetCurrentContributionAmountStats(invoices);
|
||||
|
||||
var ratesTask = rateFetcher.FetchRates(
|
||||
groupingByCurrency
|
||||
.Select((entities) => new CurrencyPair(entities.Key, primaryCurrency))
|
||||
stats.Keys
|
||||
.Select((x) => new CurrencyPair(PaymentMethodId.Parse(x).CryptoCode, primaryCurrency))
|
||||
.ToHashSet(),
|
||||
rateRules);
|
||||
|
||||
|
@ -148,8 +148,8 @@ namespace BTCPayServer.Hubs
|
|||
var tResult = await rateTask.Value;
|
||||
var rate = tResult.BidAsk?.Bid;
|
||||
if (rate == null) return;
|
||||
var currencyGroup = groupingByCurrency.Single(entities => entities.Key == rateTask.Key.Left);
|
||||
result += currencyGroup.Sum(entity => entity.ProductInformation.Price / rate.Value);
|
||||
var currencyGroup = stats[rateTask.Key.Left];
|
||||
result += currencyGroup / rate.Value;
|
||||
}));
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@
|
|||
</div>
|
||||
|
||||
<b-tooltip target="raised-amount" >
|
||||
<ul class="p-0">
|
||||
<ul class="p-0 text-uppercase">
|
||||
<li v-for="stat of paymentStats" style="list-style-type: none">
|
||||
{{stat.label}} {{stat.value}}
|
||||
</li>
|
||||
|
@ -158,6 +158,7 @@
|
|||
</div>
|
||||
<div class="card-footer text-muted d-flex" v-if="srvModel.animationsEnabled || srvModel.soundsEnabled">
|
||||
|
||||
<div class="align-self-end pr-4">Updated {{lastUpdated}}</div>
|
||||
<div class="form-check mx-1" v-if="srvModel.animationsEnabled || animation">
|
||||
<input class="form-check-input" type="checkbox" id="cbAnime" v-model="animation">
|
||||
<label class="form-check-label" for="cbAnime">
|
||||
|
@ -165,11 +166,11 @@
|
|||
</label>
|
||||
</div>
|
||||
<div class="form-check mx-1" v-if="srvModel.soundsEnabled|| sound">
|
||||
<input class="form-check-input" type="checkbox" id="cbSounds" v-model="sound">
|
||||
<label class="form-check-label" for="cbSounds">
|
||||
Sounds
|
||||
</label>
|
||||
</div>
|
||||
<input class="form-check-input" type="checkbox" id="cbSounds" v-model="sound">
|
||||
<label class="form-check-label" for="cbSounds">
|
||||
Sounds
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -82,7 +82,8 @@ addLoadEvent(function (ev) {
|
|||
startDiff: "",
|
||||
active: true,
|
||||
animation: true,
|
||||
sound: true
|
||||
sound: true,
|
||||
lastUpdated:""
|
||||
|
||||
}
|
||||
},
|
||||
|
@ -160,6 +161,7 @@ addLoadEvent(function (ev) {
|
|||
var mDiffS = moment(this.srvModel.startDate).diff(moment(), "seconds");
|
||||
this.startDiff = mDiffD > 0? mDiffD + " Days" : mDiffH> 0? mDiffH + " Hours" : mDiffM> 0? mDiffM+ " Minutes" : mDiffS> 0? mDiffS + " Seconds": "";
|
||||
}
|
||||
this.lastUpdated = moment(this.srvModel.info.lastUpdated).calendar();
|
||||
this.active = this.started && !this.ended;
|
||||
setTimeout(this.updateComputed, 1000);
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue