Implement budgeting views by calculating most values locally

This commit is contained in:
2021-12-11 12:47:41 +00:00
parent 6da1b26a2f
commit caf0126b86
6 changed files with 55 additions and 250 deletions

View File

@ -3,9 +3,7 @@ package http
import (
"fmt"
"net/http"
"time"
"git.javil.eu/jacob1123/budgeteer/postgres"
"github.com/gin-gonic/gin"
"github.com/google/uuid"
"github.com/pressly/goose/v3"
@ -72,14 +70,14 @@ func (h *Handler) clearBudget(c *gin.Context) {
}
func (h *Handler) cleanNegativeBudget(c *gin.Context) {
budgetID := c.Param("budgetid")
/*budgetID := c.Param("budgetid")
budgetUUID, err := uuid.Parse(budgetID)
if err != nil {
c.Redirect(http.StatusTemporaryRedirect, "/login")
return
}
}*/
min_date, err := h.Service.DB.GetFirstActivity(c.Request.Context(), budgetUUID)
/*min_date, err := h.Service.DB.GetFirstActivity(c.Request.Context(), budgetUUID)
date := getFirstOfMonthTime(min_date)
for {
nextDate := date.AddDate(0, 1, 0)
@ -114,6 +112,6 @@ func (h *Handler) cleanNegativeBudget(c *gin.Context) {
} else {
break
}
}
}*/
}