Remove clean-negative
This commit is contained in:
parent
a1ec7e9997
commit
e7af03b702
@ -64,49 +64,3 @@ func (h *Handler) clearBudget(c *gin.Context) {
|
|||||||
|
|
||||||
h.clearBudgetData(c, budgetUUID)
|
h.clearBudgetData(c, budgetUUID)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *Handler) cleanNegativeBudget(c *gin.Context) {
|
|
||||||
/*budgetID := c.Param("budgetid")
|
|
||||||
budgetUUID, err := uuid.Parse(budgetID)
|
|
||||||
if err != nil {
|
|
||||||
c.Redirect(http.StatusTemporaryRedirect, "/login")
|
|
||||||
return
|
|
||||||
}*/
|
|
||||||
|
|
||||||
/*min_date, err := h.Service.GetFirstActivity(c.Request.Context(), budgetUUID)
|
|
||||||
date := getFirstOfMonthTime(min_date)
|
|
||||||
for {
|
|
||||||
nextDate := date.AddDate(0, 1, 0)
|
|
||||||
params := postgres.GetCategoriesWithBalanceParams{
|
|
||||||
BudgetID: budgetUUID,
|
|
||||||
ToDate: nextDate,
|
|
||||||
FromDate: date,
|
|
||||||
}
|
|
||||||
categories, err := h.Service.GetCategoriesWithBalance(c.Request.Context(), params)
|
|
||||||
if err != nil {
|
|
||||||
c.AbortWithError(http.StatusInternalServerError, err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, category := range categories {
|
|
||||||
available := category.Available.GetFloat64()
|
|
||||||
if available >= 0 {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
var negativeAvailable postgres.Numeric
|
|
||||||
negativeAvailable.Set(-available)
|
|
||||||
createAssignment := postgres.CreateAssignmentParams{
|
|
||||||
Date: nextDate.AddDate(0, 0, -1),
|
|
||||||
Amount: negativeAvailable,
|
|
||||||
CategoryID: category.ID,
|
|
||||||
}
|
|
||||||
h.Service.CreateAssignment(c.Request.Context(), createAssignment)
|
|
||||||
}
|
|
||||||
|
|
||||||
if nextDate.Before(time.Now()) {
|
|
||||||
date = nextDate
|
|
||||||
} else {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
@ -72,7 +72,6 @@ func (h *Handler) LoadRoutes(router *gin.Engine) {
|
|||||||
budget.POST("/:budgetid/export/ynab/transactions", h.exportYNABTransactions)
|
budget.POST("/:budgetid/export/ynab/transactions", h.exportYNABTransactions)
|
||||||
budget.POST("/:budgetid/export/ynab/assignments", h.exportYNABAssignments)
|
budget.POST("/:budgetid/export/ynab/assignments", h.exportYNABAssignments)
|
||||||
budget.POST("/:budgetid/settings/clear", h.clearBudget)
|
budget.POST("/:budgetid/settings/clear", h.clearBudget)
|
||||||
budget.POST("/:budgetid/settings/clean-negative", h.cleanNegativeBudget)
|
|
||||||
|
|
||||||
transaction := authenticated.Group("/transaction")
|
transaction := authenticated.Group("/transaction")
|
||||||
transaction.POST("/new", h.newTransaction)
|
transaction.POST("/new", h.newTransaction)
|
||||||
|
@ -44,9 +44,6 @@ function deleteBudget() {
|
|||||||
function clearBudget() {
|
function clearBudget() {
|
||||||
POST("/budget/" + CurrentBudgetID.value + "/settings/clear", null)
|
POST("/budget/" + CurrentBudgetID.value + "/settings/clear", null)
|
||||||
};
|
};
|
||||||
function cleanNegative() {
|
|
||||||
// <a href="/budget/{{.Budget.ID}}/settings/clean-negative">Fix all historic negative category-balances</a>
|
|
||||||
};
|
|
||||||
function ynabImport() {
|
function ynabImport() {
|
||||||
if (transactionsFile.value == undefined || assignmentsFile.value == undefined)
|
if (transactionsFile.value == undefined || assignmentsFile.value == undefined)
|
||||||
return
|
return
|
||||||
@ -109,21 +106,6 @@ function ynabExport() {
|
|||||||
Delete budget
|
Delete budget
|
||||||
</Button>
|
</Button>
|
||||||
</RowCard>
|
</RowCard>
|
||||||
<RowCard class="flex-col p-3">
|
|
||||||
<h2 class="text-lg font-bold">
|
|
||||||
Fix all historic negative category-balances
|
|
||||||
</h2>
|
|
||||||
<p>
|
|
||||||
This restores YNABs functionality, that would substract any
|
|
||||||
overspent categories' balances from next months inflows.
|
|
||||||
</p>
|
|
||||||
<Button
|
|
||||||
class="bg-orange-500 py-2"
|
|
||||||
@click="cleanNegative"
|
|
||||||
>
|
|
||||||
Fix negative
|
|
||||||
</Button>
|
|
||||||
</RowCard>
|
|
||||||
<RowCard class="flex-col p-3">
|
<RowCard class="flex-col p-3">
|
||||||
<h2 class="text-lg font-bold">
|
<h2 class="text-lg font-bold">
|
||||||
Import YNAB Budget
|
Import YNAB Budget
|
||||||
|
Loading…
x
Reference in New Issue
Block a user