Fix transaction saving/loading

This commit is contained in:
William Brawner 2020-02-20 01:58:56 +00:00
parent 518ec83708
commit d22fc6f7cc
6 changed files with 8 additions and 8 deletions

View file

@ -137,7 +137,7 @@ export class BudgetDetailsComponent implements OnInit {
this.twigsService.getTransactions(this.budget.id, category).subscribe(transactions => {
let balance = 0;
for (const transaction of transactions) {
if (transaction.isExpense) {
if (transaction.expense) {
balance -= transaction.amount;
} else {
balance += transaction.amount;

View file

@ -46,7 +46,7 @@ export class CategoriesComponent implements OnInit {
this.twigsService.getTransactions(this.budgetId, category.id).subscribe(transactions => {
let balance = 0;
for (const transaction of transactions) {
if (transaction.isExpense) {
if (transaction.expense) {
balance -= transaction.amount;
} else {
balance += transaction.amount;

View file

@ -131,7 +131,7 @@ export class TwigsHttpService implements TwigsService {
description: string,
amount: number,
date: Date,
isExpense: boolean,
expense: boolean,
category: number
): Observable<Transaction> {
const params = {
@ -139,7 +139,7 @@ export class TwigsHttpService implements TwigsService {
'description': description,
'date': date,
'amount': amount,
'expense': isExpense,
'expense': expense,
'categoryId': category,
'budgetId': budgetId
};

View file

@ -249,7 +249,7 @@ export class TwigsLocalService implements TwigsService {
transaction.description = description;
transaction.amount = amount;
transaction.date = date;
transaction.isExpense = isExpense;
transaction.expense = isExpense;
transaction.categoryId = category;
transaction.budgetId = budgetId;
transaction.id = this.transactions.length + 1;

View file

@ -77,7 +77,7 @@ export class AddEditTransactionComponent implements OnInit, OnChanges, OnDestroy
amount: this.currentTransaction.amount * 100,
date: this.currentTransaction.date,
category: this.currentTransaction.categoryId,
isExpense: this.currentTransaction.isExpense
expense: this.currentTransaction.expense
}
);
} else {
@ -88,7 +88,7 @@ export class AddEditTransactionComponent implements OnInit, OnChanges, OnDestroy
this.currentTransaction.description,
this.currentTransaction.amount * 100,
this.currentTransaction.date,
this.currentTransaction.isExpense,
this.currentTransaction.expense,
this.currentTransaction.categoryId,
);
}

View file

@ -4,7 +4,7 @@ export class Transaction {
description: string = null;
date: Date = new Date();
amount: number;
isExpense: boolean;
expense: boolean;
categoryId: number;
budgetId: number;
createdBy: number;