Spending != Amount bug fixed
This commit is contained in:
parent
097835de83
commit
a7f51909cd
@ -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) {
|
||||
|
@ -105,7 +105,7 @@ fun Add(
|
||||
spending = it
|
||||
}
|
||||
},
|
||||
label = { Text("Spending") },
|
||||
label = { Text("Amount") },
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
)
|
||||
|
@ -81,7 +81,7 @@ fun Edit(
|
||||
editViewModel.updateEntry(entry.copy(amount = it.toFloat()))
|
||||
}
|
||||
},
|
||||
label = { Text("Spending") },
|
||||
label = { Text("Amount") },
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
|
||||
|
@ -36,8 +36,6 @@ class HomeViewModel(private val repository: EntryRepository) : ViewModel() {
|
||||
}
|
||||
entryUIState = EntryListUIState(entries)
|
||||
}
|
||||
//findCategoryByID()
|
||||
|
||||
}
|
||||
|
||||
fun calculateBalance() {
|
||||
|
Loading…
Reference in New Issue
Block a user