fix choice key and currency data

This commit is contained in:
Kukks
2019-01-08 15:49:07 +01:00
parent 89071e40fc
commit 94fb738c67
4 changed files with 14 additions and 3 deletions

View File

@@ -318,6 +318,7 @@ namespace BTCPayServer.Hubs
ResetEveryAmount = settings.ResetEveryAmount,
PerkCount = perkCount,
ResetEvery = Enum.GetName(typeof(CrowdfundResetEvery),settings.ResetEvery),
CurrencyData = _AppsHelper.GetCurrencyData(settings.TargetCurrency, true),
Info = new ViewCrowdfundViewModel.CrowdfundInfo()
{
TotalContributors = invoices.Length,

View File

@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using BTCPayServer.Services.Rates;
namespace BTCPayServer.Models.AppViewModels
{
@@ -34,6 +35,8 @@ namespace BTCPayServer.Models.AppViewModels
public Dictionary<string, int> PerkCount { get; set; }
public CurrencyData CurrencyData { get; set; }
public class CrowdfundInfo
{
public int TotalContributors { get; set; }

View File

@@ -49,11 +49,11 @@
<div class="row py-2 text-center">
<div class="col-sm border-right" id="raised-amount">
<h5>{{srvModel.info.currentAmount + srvModel.info.currentPendingAmount }} {{targetCurrency}} </h5>
<h5>{{ raisedAmount }} {{targetCurrency}} </h5>
<h5 class="text-muted">Raised</h5>
</div>
<div class="col-sm border-right" id="goal-raised">
<h5>{{srvModel.info.progressPercentage + srvModel.info.pendingProgressPercentage }}%</h5>
<h5>{{ percentageRaisedAmount }}%</h5>
<h5 class="text-muted">Of Goal</h5>
</div>
<div class="col-sm border-right">

View File

@@ -49,7 +49,8 @@ addLoadEvent(function (ev) {
if(!this.active){
return;
}
eventAggregator.$emit("contribute", {amount: this.amount, choiceKey: this.choiceKey});
eventAggregator.$emit("contribute", {amount: this.amount, choiceKey: this.perk.id});
},
expand: function(){
if(this.canExpand){
@@ -88,6 +89,12 @@ addLoadEvent(function (ev) {
}
},
computed: {
raisedAmount: function(){
return parseFloat(this.srvModel.info.currentAmount + this.srvModel.info.currentPendingAmount ).toFixed(this.srvModel.currencyData.divisibility) ;
},
percentageRaisedAmount: function(){
return parseFloat(this.srvModel.info.progressPercentage + this.srvModel.info.pendingProgressPercentage ).toFixed(2);
},
targetCurrency: function(){
return this.srvModel.targetCurrency.toUpperCase();
},