Spending != Amount bug fixed

This commit is contained in:
Florian 2025-01-17 11:33:31 +01:00
parent 097835de83
commit a7f51909cd
4 changed files with 2 additions and 16 deletions

View File

@ -7,13 +7,9 @@ import androidx.compose.runtime.setValue
import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import at.xaxa.ledger.data.Entry
import at.xaxa.ledger.data.EntryRepository
import at.xaxa.ledger.data.db.Category.CategoryEntity
import at.xaxa.ledger.data.db.Entry.EntryEntity
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flowOf
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
@ -61,14 +57,6 @@ class EditCategoryViewModel(private val savedStateHandle: SavedStateHandle, priv
}
}
fun findCategoryByID(categoryId: Int) {
viewModelScope.launch {
val category = withContext(Dispatchers.IO) {
entryRepository.findCategoryById(categoryId)
}
categoryUi = CategoryUIState(category)
}
}
fun findEntryByCategoryId() {
viewModelScope.launch {
val fetchedEntries = withContext(Dispatchers.IO) {

View File

@ -105,7 +105,7 @@ fun Add(
spending = it
}
},
label = { Text("Spending") },
label = { Text("Amount") },
modifier = Modifier
.fillMaxWidth()
)

View File

@ -81,7 +81,7 @@ fun Edit(
editViewModel.updateEntry(entry.copy(amount = it.toFloat()))
}
},
label = { Text("Spending") },
label = { Text("Amount") },
modifier = Modifier.fillMaxWidth()
)

View File

@ -36,8 +36,6 @@ class HomeViewModel(private val repository: EntryRepository) : ViewModel() {
}
entryUIState = EntryListUIState(entries)
}
//findCategoryByID()
}
fun calculateBalance() {