Skip to content

Open source personal finance application

fix(trnForm): calculator writes to wrong field on expense/income tab, sync transfer amounts, remove unused fn

Ilya Komichevdef487335a0d
diff --git a/app/components/categories/CommandPalette.vue b/app/components/categories/CommandPalette.vue
index d35ef6b7..23a7c5de 100644
--- a/app/components/categories/CommandPalette.vue
+++ b/app/components/categories/CommandPalette.vue
@@ -38,17 +38,6 @@ watch([hasFavorites, hasRecent], () => {
filter.value = 'all'
}, { immediate: true })
-function buildCategoryItem(id: CategoryId) {
- const category = categoriesStore.items[id]!
- const parentId = category.parentId
- const parent = parentId ? categoriesStore.items[parentId] : null
- return {
- id,
- ...category,
- suffix: parent?.name ?? category.name,
- }
-}
-
const allCats = computed(() => {
const adjustmentCategory = categoriesStore.items.adjustment!
const adjustmentGroup = {
diff --git a/app/components/trnForm/main/AmountTransfer.vue b/app/components/trnForm/main/AmountTransfer.vue
index 7cf4e335..e2eca275 100644
--- a/app/components/trnForm/main/AmountTransfer.vue
+++ b/app/components/trnForm/main/AmountTransfer.vue
@@ -37,6 +37,11 @@ watch(
trnsFormStore.values.amount[1] = trnsFormStore.values.amount[0]
trnsFormStore.values.amountRaw[1] = trnsFormStore.values.amountRaw[0]
}
+
+ if (trnsFormStore.isSameCurrencyTransfer && trnsFormStore.values.amount[2] === 0) {
+ trnsFormStore.values.amount[2] = trnsFormStore.values.amount[1]
+ trnsFormStore.values.amountRaw[2] = trnsFormStore.values.amountRaw[1]
+ }
}
},
{ immediate: true },
diff --git a/app/components/trnForm/useTrnsFormStore.ts b/app/components/trnForm/useTrnsFormStore.ts
index 5127918d..f43da299 100644
--- a/app/components/trnForm/useTrnsFormStore.ts
+++ b/app/components/trnForm/useTrnsFormStore.ts
@@ -109,7 +109,7 @@ export const useTrnsFormStore = defineStore('trnForm', () => {
function onClickCalculator(key: CalculatorKey) {
const value = createExpressionString(key, values.amountRaw[activeAmountIdx.value] ?? '')
- if (isSameCurrencyTransfer.value)
+ if (values.trnType === TrnType.Transfer && isSameCurrencyTransfer.value)
onChangeTransferAmountSynced(value)
else
onChangeAmount(value)
@@ -129,8 +129,15 @@ export const useTrnsFormStore = defineStore('trnForm', () => {
values.amountRaw[2] = ''
}
- // different → same: copy expense amount to income, reset transferType
+ // different → same: pick the user-entered amount and sync both sides
if (!wasSame && isSameCurrencyTransfer.value) {
+ const pickIdx = values.amount[1] !== 0
+ ? 1
+ : values.amount[2] !== 0
+ ? 2
+ : values.transferType === 'income' ? 2 : 1
+ values.amount[1] = values.amount[pickIdx]
+ values.amountRaw[1] = values.amountRaw[pickIdx]
values.amount[2] = values.amount[1]
values.amountRaw[2] = values.amountRaw[1]
values.transferType = 'expense'
@@ -257,6 +264,13 @@ export const useTrnsFormStore = defineStore('trnForm', () => {
values.trnType = props.trn.type
values.desc = props.trn.desc
values.date = props.trn.date
+
+ // Transfer now same-currency but stored amounts differ: normalize to expense amount
+ if (props.trn.type === TrnType.Transfer && isSameCurrencyTransfer.value
+ && values.amount[1] !== values.amount[2]) {
+ values.amount[2] = values.amount[1]
+ values.amountRaw[2] = values.amountRaw[1]
+ }
}
}
diff --git a/i18n/locales/en-US.js b/i18n/locales/en-US.js
index d853eace..4e84da98 100644
--- a/i18n/locales/en-US.js
+++ b/i18n/locales/en-US.js
@@ -281,7 +281,6 @@ export default {
average: {
forLast: 'for the last periods',
},
- noDataForPeriod: 'No statistics for the selected period',
catButtons: {
isLines: 'Amount lines',
isRoundIcon: 'Icons background',
@@ -347,6 +346,7 @@ export default {
title: 'Wallets',
},
},
+ noDataForPeriod: 'No statistics for the selected period',
title: 'Dashboard',
},
diff --git a/i18n/locales/ru-RU.js b/i18n/locales/ru-RU.js
index 658ef544..6bf7d85a 100644
--- a/i18n/locales/ru-RU.js
+++ b/i18n/locales/ru-RU.js
@@ -281,7 +281,6 @@ export default {
average: {
forLast: 'за прошлые периоды',
},
- noDataForPeriod: 'Нет статистики за выбранный период',
catButtons: {
isLines: 'Линии сумм',
isRoundIcon: 'Фон иконок',
@@ -347,6 +346,7 @@ export default {
title: 'Кошельки',
},
},
+ noDataForPeriod: 'Нет статистики за выбранный период',
title: 'Статистика',
},
diff --git a/package.json b/package.json
index 51c8e17c..396f7450 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "@ilkome/finapp",
"type": "module",
- "version": "7.6.1",
+ "version": "7.6.2",
"packageManager": "[email protected]",
"description": "Finapp helps you easily track and manage personal finances.",
"author": "Ilya Komichev @ilkome",