mirror of
https://github.com/linuxserver/budge.git
synced 2026-03-09 00:08:38 +08:00
cleanup
This commit is contained in:
parent
bbfc7b8c03
commit
d4a6bf5d7e
@ -166,7 +166,6 @@ export class AccountsController extends Controller {
|
||||
}
|
||||
|
||||
const clearedTransactions = await getRepository(Transaction).find({ accountId: account.id, status: TransactionStatus.Cleared })
|
||||
console.log(clearedTransactions)
|
||||
for (const transaction of clearedTransactions) {
|
||||
transaction.status = TransactionStatus.Reconciled
|
||||
await getRepository(Transaction).update(transaction.id, transaction.getUpdatePayload())
|
||||
|
||||
@ -24,8 +24,6 @@ export type CategoryMonthOriginalValues = {
|
||||
export class CategoryMonthCache {
|
||||
static cache: { [key: string]: CategoryMonthOriginalValues } = {}
|
||||
|
||||
static transfers: string[] = []
|
||||
|
||||
public static get(id: string): CategoryMonthOriginalValues | null {
|
||||
if (CategoryMonthCache.cache[id]) {
|
||||
return CategoryMonthCache.cache[id]
|
||||
@ -114,9 +112,9 @@ export class CategoryMonth {
|
||||
categoryId: this.categoryId,
|
||||
budgetMonthId: this.budgetMonthId,
|
||||
month: this.month,
|
||||
budgeted: this.budgeted,
|
||||
activity: this.activity,
|
||||
balance: this.balance,
|
||||
budgeted: {...this.budgeted},
|
||||
activity: {...this.activity},
|
||||
balance: {...this.balance},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -12,7 +12,6 @@ export class BudgetMonths extends Repository<BudgetMonth> {
|
||||
const months = await budget.getMonths()
|
||||
|
||||
let newBudgetMonth
|
||||
let counter = 1
|
||||
let direction = 1
|
||||
let monthFrom = new Date()
|
||||
monthFrom.setDate(1)
|
||||
@ -20,20 +19,18 @@ export class BudgetMonths extends Repository<BudgetMonth> {
|
||||
if (month < months[0]) {
|
||||
monthFrom = new Date(`${months[0]}T12:00:00`)
|
||||
direction = -1
|
||||
counter = -1
|
||||
} else if (month > months[months.length - 1]) {
|
||||
monthFrom = new Date(`${months[months.length - 1]}T12:00:00`)
|
||||
}
|
||||
|
||||
// iterate over all months until we hit the first budget month
|
||||
do {
|
||||
monthFrom.setMonth(monthFrom.getMonth() + counter)
|
||||
monthFrom.setMonth(monthFrom.getMonth() + direction)
|
||||
newBudgetMonth = this.create({
|
||||
budgetId,
|
||||
month: formatMonthFromDateString(monthFrom),
|
||||
})
|
||||
await this.insert(newBudgetMonth)
|
||||
newBudgetMonth.budget = Promise.resolve(budget)
|
||||
} while (newBudgetMonth.month !== month)
|
||||
|
||||
return newBudgetMonth
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user