diff --git a/README.md b/README.md index f33e813..e03ab3e 100644 --- a/README.md +++ b/README.md @@ -23,13 +23,15 @@ If you wish to contribute other bank statement csv formats or features then plea 1. ~~Set up adding statement lines and displaying them~~ 2. ~~Set up adding and saving statement lines with localstorage, and reloading from localstorage~~ -3. Set up importing a csv file (bank statement) to the data structure, adding each line -4. Modify that to ignore any entries that already exist upon import +3. ~~Set up importing a csv file (bank statement) to the data structure, adding each line ignoring different accounts~~ +4. ~~Modify that to ignore any entries that already exist upon import~~ 5. Set up a system to enable selecting a tag from the preset tags for each line when importing 6. Modify that to enable creating a new tag and saving that to localstorage ### Things for later versions +- Sort transactions by date order +- Be able to handle separate accounts, and split transactions into these - Be able to set rules to auto apply these, or manually set them for each item on a statement when adding it in - Be able to summarise (with graphs) expenditure and savings for any selected time period - Be able to expand the above summaries for more detailed information diff --git a/src/components/AddTransaction.vue b/src/components/AddTransaction.vue index 4a845ea..dd7731c 100644 --- a/src/components/AddTransaction.vue +++ b/src/components/AddTransaction.vue @@ -2,7 +2,7 @@
- +
@@ -46,7 +46,6 @@ export default { } result.forEach (function(transaction) { - alert(JSON.stringify(transaction["Date"])); const newTransaction = { id: uuid.v4(), date: transaction["Date"], diff --git a/src/views/Home.vue b/src/views/Home.vue index 40b4dca..f730dac 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -63,8 +63,16 @@ export default { localStorage.setItem("transactionStorage", JSON.stringify(this.transactions)); }, addTransaction(newTransaction) { - this.transactions.push(newTransaction); + // Determine whether this transaction already exists + const found = this.transactions.some(transaction => transaction.date === newTransaction.date && transaction.transactionTypeDescription === newTransaction.transactionTypeDescription && transaction.description === newTransaction.description && transaction.isExpenditure === newTransaction.isExpenditure && transaction.amount === newTransaction.amount && transaction.balance === newTransaction.balance); + if (found) { + alert('found duplicate transaction, not adding it - ' + newTransaction.date + ' :: ' + newTransaction.description); + } + else { + this.transactions.push(newTransaction); this.saveTransactions(); + } + }, saveTransactions() { localStorage.setItem("lastname", "Smith");