fix
This commit is contained in:
@@ -53,8 +53,8 @@ public class DashboardService
|
||||
Id = x.Id,
|
||||
Name = x.Name,
|
||||
Balance = x.Balance,
|
||||
CurrencyName = x.CurrencyName,
|
||||
CurrencyShortName = x.CurrencyShortName,
|
||||
CurrencyName = x.CurrencyName!,
|
||||
CurrencyShortName = x.CurrencyShortName!,
|
||||
CurrencyRate = x.CurrencyRate,
|
||||
CurrencyQuantity = x.CurrencyQuantity,
|
||||
})
|
||||
@@ -76,7 +76,6 @@ public class DashboardService
|
||||
.ToList();
|
||||
|
||||
var currencies = data
|
||||
.Where(x => x.Amount != 0)
|
||||
.Select(x => x.CurrencyId)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
@@ -87,29 +86,49 @@ public class DashboardService
|
||||
|
||||
return new DashboardIncomeData
|
||||
{
|
||||
Data = data.Select(x => new
|
||||
Data = data.Select(x => new
|
||||
{
|
||||
Id = x.Id.ToShort(),
|
||||
Name = x.Name,
|
||||
ValueRaw = x.Amount,
|
||||
Value = (x.Amount * rates.FirstOrDefault(r => r.Key == x.CurrencyId).Value),
|
||||
})
|
||||
.GroupBy(x => new { x.Id, x.Name })
|
||||
.Select( x => new DashboardIncomeDataItem
|
||||
.GroupBy(x => new
|
||||
{
|
||||
x.Id,
|
||||
x.Name,
|
||||
})
|
||||
.Select(x => new DashboardIncomeDataItem
|
||||
{
|
||||
Id = x.Key.Id,
|
||||
Name = x.Key.Name,
|
||||
Value = x.Sum(s => s.Value),
|
||||
ValueRaw = x.Sum(s => s.ValueRaw),
|
||||
})
|
||||
.OrderBy(x => x.Name)
|
||||
.ToList(),
|
||||
|
||||
Details = data.Select(x => new DashboardIncomeDataItem
|
||||
Details = data.Select(x => new
|
||||
{
|
||||
Id = x.Id.ToShort(),
|
||||
Currency = x.CurrencyId,
|
||||
Name = x.Name,
|
||||
Id = x.CurrencyId,
|
||||
Name = x.CurrencyName,
|
||||
ValueRaw = x.Amount,
|
||||
Value = (x.Amount * rates.FirstOrDefault(r => r.Key == x.CurrencyId).Value),
|
||||
}).ToList()
|
||||
})
|
||||
.GroupBy(x => new
|
||||
{
|
||||
x.Id,
|
||||
x.Name,
|
||||
})
|
||||
.Select(x => new DashboardIncomeDataItem
|
||||
{
|
||||
Id = x.Key.Id,
|
||||
Name = x.Key.Name,
|
||||
Value = x.Sum(s => s.Value),
|
||||
ValueRaw = x.Sum(s => s.ValueRaw),
|
||||
})
|
||||
.OrderBy(x => x.Name)
|
||||
.ToList(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -124,7 +143,6 @@ public class DashboardService
|
||||
.ToList();
|
||||
|
||||
var currencies = data
|
||||
.Where(x => x.Amount != 0)
|
||||
.Select(x => x.CurrencyId)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
@@ -139,25 +157,45 @@ public class DashboardService
|
||||
{
|
||||
Id = x.Id.ToShort(),
|
||||
Name = x.Name,
|
||||
ValueRaw = x.Amount,
|
||||
Value = (x.Amount * rates.FirstOrDefault(r => r.Key == x.CurrencyId).Value),
|
||||
})
|
||||
.GroupBy(x => new { x.Id, x.Name })
|
||||
.GroupBy(x => new
|
||||
{
|
||||
x.Id,
|
||||
x.Name,
|
||||
})
|
||||
.Select(x => new DashboardIncomeDataItem
|
||||
{
|
||||
Id = x.Key.Id,
|
||||
Name = x.Key.Name,
|
||||
Value = x.Sum(s => s.Value),
|
||||
ValueRaw = x.Sum(s => s.ValueRaw),
|
||||
})
|
||||
.OrderBy(x => x.Name)
|
||||
.ToList(),
|
||||
|
||||
Details = data.Select(x => new DashboardIncomeDataItem
|
||||
{
|
||||
Id = x.Id.ToShort(),
|
||||
Currency = x.CurrencyId,
|
||||
Name = x.Name,
|
||||
ValueRaw = x.Amount,
|
||||
Value = (x.Amount * rates.FirstOrDefault(r => r.Key == x.CurrencyId).Value),
|
||||
}).ToList()
|
||||
Details = data.Select(x => new
|
||||
{
|
||||
Id = x.CurrencyId,
|
||||
Name = x.CurrencyName,
|
||||
ValueRaw = x.Amount,
|
||||
Value = (x.Amount * rates.FirstOrDefault(r => r.Key == x.CurrencyId).Value),
|
||||
})
|
||||
.GroupBy(x => new
|
||||
{
|
||||
x.Id,
|
||||
x.Name,
|
||||
})
|
||||
.Select(x => new DashboardIncomeDataItem
|
||||
{
|
||||
Id = x.Key.Id,
|
||||
Name = x.Key.Name,
|
||||
Value = x.Sum(s => s.Value),
|
||||
ValueRaw = x.Sum(s => s.ValueRaw),
|
||||
})
|
||||
.OrderBy(x => x.Name)
|
||||
.ToList(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user