Fix the type by id page

This commit is contained in:
2025-07-16 11:23:51 +01:00
parent 9167688e1e
commit b2eca1899b
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -49,7 +49,7 @@ func GetAllTypes() ([]Type, error) {
return typeList, nil
}
func GetType(storeID int) (Type, error) {
func GetType(typID int) (Type, error) {
db, err := sql.Open("sqlite3", "./data/data.db")
if err != nil {
return Type{}, err
@@ -58,7 +58,7 @@ func GetType(storeID int) (Type, error) {
query := "SELECT TypeID,TypeName " +
"FROM expenseTypes " +
"WHERE TypeID = " + strconv.Itoa(storeID)
"WHERE TypeID = " + strconv.Itoa(typID)
var nType Type
err = db.QueryRow(query).Scan(&nType.TypeID, &nType.TypeName)
+2 -2
View File
@@ -60,11 +60,11 @@ func typePage(c *gin.Context) {
c.Redirect(404, "/404")
}
typ, err := expenses.GetCategory(typeID)
typ, err := expenses.GetType(typeID)
content := templating.HtmlTemplate(
fp.Join(cfg.AssetsDir, "/htmx/type.html"),
map[string]any{
"category": typ,
"type": typ,
},
)