chore: update to go packages versions

This commit is contained in:
2024-01-31 21:48:35 +00:00
parent c00bd87cf7
commit d08a0a2a4c
8 changed files with 503 additions and 107 deletions

View File

@@ -1,7 +1,6 @@
package model_classes
import (
"fmt"
"net/http"
"strconv"
@@ -54,7 +53,7 @@ func HandleList(handle *Handle) {
return Error500(err)
}
rows, err := handle.Db.Query("select id, file_path, model_mode, status from model_data_point where class_id=$1 limit 10 offset $2;", id, page * 10)
rows, err := handle.Db.Query("select id, file_path, model_mode, status from model_data_point where class_id=$1 limit 11 offset $2;", id, page * 10)
if err != nil {
return Error500(err)
}
@@ -77,31 +76,16 @@ func HandleList(handle *Handle) {
}
got = append(got, nrow)
}
max_len := min(11, len(got))
rows_count, err := handle.Db.Query("select count(*) from model_data_point where class_id=$1;", id)
if err != nil {
return Error500(err)
}
defer rows_count.Close()
if !rows_count.Next() {
fmt.Printf("select count(*) from model_data_point where class_id='%s';\n", id)
return Error500(nil)
}
count := 0
err = rows_count.Scan(&count)
if err != nil {
return Error500(err)
}
LoadDefineTemplate(w, "/models/edit.html", "data-model-create-class-table-table", c.AddMap(AnyMap{
"List": got,
"Count": count,
"List": got[0:max_len],
"Page": page,
"Id": id,
"Name": name,
"Model": model,
"ShowNext": len(got) == 11,
}))
return nil
})