Updated that Holding.quantity is of type Double, not Int
This commit is contained in:
parent
02d8d14ede
commit
fe853f03e9
|
@ -331,7 +331,7 @@ open class SqliteBankingRepository : BankingRepository {
|
|||
|
||||
protected open fun getAllHoldings(): List<HoldingEntity> =
|
||||
accountTransactionQueries.selectAllHoldings { id, bankId, accountId, name, isin, wkn, quantity, currency, totalBalance, marketValue, performancePercentage, totalCostPrice, averageCostPrice, pricingTime, buyingDate ->
|
||||
HoldingEntity(id, bankId, accountId, name, isin, wkn, mapToInt(quantity), currency, mapToAmount(totalBalance), mapToAmount(marketValue), performancePercentage?.toFloat(), mapToAmount(totalCostPrice), mapToAmount(averageCostPrice), mapToInstant(pricingTime), mapToDate(buyingDate))
|
||||
HoldingEntity(id, bankId, accountId, name, isin, wkn, quantity, currency, mapToAmount(totalBalance), mapToAmount(marketValue), performancePercentage?.toFloat(), mapToAmount(totalCostPrice), mapToAmount(averageCostPrice), mapToInstant(pricingTime), mapToDate(buyingDate))
|
||||
}.executeAsList()
|
||||
|
||||
override suspend fun persistHoldings(bankAccount: BankAccountEntity, holdings: List<Holding>): List<HoldingEntity> =
|
||||
|
@ -348,10 +348,10 @@ open class SqliteBankingRepository : BankingRepository {
|
|||
|
||||
holding.name, holding.isin, holding.wkn,
|
||||
|
||||
mapInt(holding.quantity), holding.currency,
|
||||
holding.quantity, holding.currency,
|
||||
|
||||
mapAmount(holding.totalBalance), mapAmount(holding.marketValue),
|
||||
holding.performancePercentage?.toDouble(),
|
||||
holding.performancePercentage,
|
||||
mapAmount(holding.totalCostPrice), mapAmount(holding.averageCostPrice),
|
||||
|
||||
mapInstant(holding.pricingTime), mapDate(holding.buyingDate)
|
||||
|
@ -365,7 +365,7 @@ open class SqliteBankingRepository : BankingRepository {
|
|||
holdings.onEach { holding ->
|
||||
accountTransactionQueries.updateHolding(
|
||||
holding.name, holding.isin, holding.wkn,
|
||||
mapInt(holding.quantity), holding.currency,
|
||||
holding.quantity, holding.currency,
|
||||
|
||||
mapAmount(holding.totalBalance), mapAmount(holding.marketValue),
|
||||
holding.performancePercentage?.toDouble(),
|
||||
|
|
|
@ -15,7 +15,7 @@ class HoldingEntity(
|
|||
isin: String? = null,
|
||||
wkn: String? = null,
|
||||
|
||||
quantity: Int? = null,
|
||||
quantity: Double? = null,
|
||||
currency: String? = null,
|
||||
|
||||
totalBalance: Amount? = null,
|
||||
|
|
|
@ -182,7 +182,7 @@ CREATE TABLE IF NOT EXISTS Holding (
|
|||
isin TEXT,
|
||||
wkn TEXT,
|
||||
|
||||
quantity INTEGER ,
|
||||
quantity REAL,
|
||||
currency TEXT,
|
||||
|
||||
totalBalance TEXT,
|
||||
|
|
|
@ -10,8 +10,8 @@ import net.codinux.banking.ui.forms.RoundedCornersCard
|
|||
@Preview
|
||||
@Composable
|
||||
fun HoldingListItemPreview() {
|
||||
val holding1 = Holding("MUL Amundi MSCI World V", null, null, 1693, "EUR", Amount("18578.04"), Amount("16.888"), -0.35f, Amount("17944.48"), Amount("16.828"))
|
||||
val holding2 = Holding("NVIDIA Corp.", null, null, 214, "EUR", Amount("21455.36"), Amount("100.18"), 8.8f, Amount("19872.04"), Amount("92.04"))
|
||||
val holding1 = Holding("MUL Amundi MSCI World V", null, null, 1693.0, "EUR", Amount("18578.04"), Amount("16.888"), -0.35f, Amount("17944.48"), Amount("16.828"))
|
||||
val holding2 = Holding("NVIDIA Corp.", null, null, 214.0, "EUR", Amount("21455.36"), Amount("100.18"), 8.8f, Amount("19872.04"), Amount("92.04"))
|
||||
|
||||
RoundedCornersCard {
|
||||
Column {
|
||||
|
|
|
@ -70,7 +70,7 @@ fun HoldingListItem(holding: Holding, isOddItem: Boolean = false, isNotLastItem:
|
|||
Row(Modifier.weight(1f).padding(end = 6.dp), verticalAlignment = Alignment.CenterVertically) {
|
||||
// TODO: set maxLines = 1 and TextOverflow.Ellipsis
|
||||
if (holding.quantity != null) {
|
||||
Text(holding.quantity.toString() + " Stück, ")
|
||||
Text(holding.quantity.toString().replace(".0", "").replace(".", ",") + " Stück, ")
|
||||
}
|
||||
|
||||
if (holding.averageCostPrice != null) {
|
||||
|
|
Loading…
Reference in New Issue