Remove clean-negative

This commit is contained in:
Jan Bader 2022-04-06 19:51:12 +00:00 committed by Gitea
parent a1ec7e9997
commit e7af03b702
3 changed files with 0 additions and 65 deletions

View File

@ -64,49 +64,3 @@ func (h *Handler) clearBudget(c *gin.Context) {
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
}
}*/
}

View File

@ -72,7 +72,6 @@ func (h *Handler) LoadRoutes(router *gin.Engine) {
budget.POST("/:budgetid/export/ynab/transactions", h.exportYNABTransactions)
budget.POST("/:budgetid/export/ynab/assignments", h.exportYNABAssignments)
budget.POST("/:budgetid/settings/clear", h.clearBudget)
budget.POST("/:budgetid/settings/clean-negative", h.cleanNegativeBudget)
transaction := authenticated.Group("/transaction")
transaction.POST("/new", h.newTransaction)

View File

@ -44,9 +44,6 @@ function deleteBudget() {
function clearBudget() {
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() {
if (transactionsFile.value == undefined || assignmentsFile.value == undefined)
return
@ -109,21 +106,6 @@ function ynabExport() {
Delete budget
</Button>
</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">
<h2 class="text-lg font-bold">
Import YNAB Budget