mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 14:34:23 +01:00
Code formatting updates (#4502)
* Editorconfig: Add space_before_self_closing setting This was a difference between the way dotnet-format and Rider format code. See https://www.jetbrains.com/help/rider/EditorConfig_Index.html * Editorconfig: Keep 4 spaces indentation for Swagger JSON files They are all formatted that way, let's keep it like that. * Apply dotnet-format, mostly white-space related changes
This commit is contained in:
@@ -48,7 +48,7 @@ namespace BTCPayServer.Services.Apps
|
||||
_storeRepository = storeRepository;
|
||||
_HtmlSanitizer = htmlSanitizer;
|
||||
}
|
||||
|
||||
|
||||
public async Task<object> GetAppInfo(string appId)
|
||||
{
|
||||
var app = await GetApp(appId, AppType.Crowdfund, true);
|
||||
@@ -120,7 +120,7 @@ namespace BTCPayServer.Services.Apps
|
||||
return rate * value;
|
||||
})));
|
||||
}
|
||||
|
||||
|
||||
var perks = Parse(settings.PerksTemplate, settings.TargetCurrency);
|
||||
if (settings.SortPerksByPopularity)
|
||||
{
|
||||
@@ -202,7 +202,7 @@ namespace BTCPayServer.Services.Apps
|
||||
var currencyData = _Currencies.GetCurrencyData(settings.TargetCurrency, true);
|
||||
var perks = Parse(settings.PerksTemplate, settings.TargetCurrency);
|
||||
var perkCount = paidInvoices
|
||||
.Where(entity => entity.Currency.Equals(settings.TargetCurrency, StringComparison.OrdinalIgnoreCase) &&
|
||||
.Where(entity => entity.Currency.Equals(settings.TargetCurrency, StringComparison.OrdinalIgnoreCase) &&
|
||||
// we need the item code to know which perk it is and group by that
|
||||
!string.IsNullOrEmpty(entity.Metadata.ItemCode))
|
||||
.GroupBy(entity => entity.Metadata.ItemCode)
|
||||
@@ -210,7 +210,8 @@ namespace BTCPayServer.Services.Apps
|
||||
{
|
||||
var total = entities
|
||||
.Sum(entity => entity.GetPayments(true)
|
||||
.Sum(pay => {
|
||||
.Sum(pay =>
|
||||
{
|
||||
var paymentMethodId = pay.GetPaymentMethodId();
|
||||
var value = pay.GetCryptoPaymentData().GetValue() - pay.NetworkFee;
|
||||
var rate = entity.GetPaymentMethod(paymentMethodId).Rate;
|
||||
@@ -228,7 +229,7 @@ namespace BTCPayServer.Services.Apps
|
||||
};
|
||||
})
|
||||
.OrderByDescending(stats => stats.SalesCount);
|
||||
|
||||
|
||||
return perkCount;
|
||||
}
|
||||
|
||||
@@ -263,7 +264,7 @@ namespace BTCPayServer.Services.Apps
|
||||
};
|
||||
})
|
||||
.OrderByDescending(stats => stats.SalesCount);
|
||||
|
||||
|
||||
return itemCount;
|
||||
}
|
||||
|
||||
@@ -281,7 +282,7 @@ namespace BTCPayServer.Services.Apps
|
||||
items = Parse(posS.Template, posS.Currency);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
var invoices = await GetInvoicesForApp(app);
|
||||
var paidInvoices = invoices.Where(IsPaid).ToArray();
|
||||
var series = paidInvoices
|
||||
@@ -308,7 +309,7 @@ namespace BTCPayServer.Services.Apps
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return new SalesStats
|
||||
{
|
||||
SalesCount = series.Sum(i => i.SalesCount),
|
||||
@@ -322,7 +323,7 @@ namespace BTCPayServer.Services.Apps
|
||||
public decimal FiatPrice { get; set; }
|
||||
public DateTime Date { get; set; }
|
||||
}
|
||||
|
||||
|
||||
private static Func<List<InvoiceStatsItem>, InvoiceEntity, List<InvoiceStatsItem>> AggregateInvoiceEntitiesForStats(ViewPointOfSaleViewModel.Item[] items)
|
||||
{
|
||||
return (res, e) =>
|
||||
@@ -331,12 +332,14 @@ namespace BTCPayServer.Services.Apps
|
||||
{
|
||||
// flatten single items from POS data
|
||||
var data = JsonConvert.DeserializeObject<PosAppData>(e.Metadata.PosData);
|
||||
if (data is not { Cart.Length: > 0 }) return res;
|
||||
if (data is not { Cart.Length: > 0 })
|
||||
return res;
|
||||
foreach (var lineItem in data.Cart)
|
||||
{
|
||||
var item = items.FirstOrDefault(p => p.Id == lineItem.Id);
|
||||
if (item == null) continue;
|
||||
|
||||
if (item == null)
|
||||
continue;
|
||||
|
||||
for (var i = 0; i < lineItem.Count; i++)
|
||||
{
|
||||
res.Add(new InvoiceStatsItem
|
||||
@@ -386,7 +389,7 @@ namespace BTCPayServer.Services.Apps
|
||||
{
|
||||
return invoice.GetInternalTags("APP#");
|
||||
}
|
||||
|
||||
|
||||
private async Task<InvoiceEntity[]> GetInvoicesForApp(AppData appData, DateTime? startDate = null)
|
||||
{
|
||||
var invoices = await _InvoiceRepository.GetInvoices(new InvoiceQuery()
|
||||
@@ -781,13 +784,13 @@ namespace BTCPayServer.Services.Apps
|
||||
public decimal Total { get; set; }
|
||||
public string TotalFormatted { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class SalesStats
|
||||
{
|
||||
public int SalesCount { get; set; }
|
||||
public IEnumerable<SalesStatsItem> Series { get; set; }
|
||||
}
|
||||
|
||||
|
||||
public class SalesStatsItem
|
||||
{
|
||||
public DateTime Date { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user