From 58b75527146f9cd4f4f4d1cb8fa716834f97cd65 Mon Sep 17 00:00:00 2001 From: jbergner Date: Sun, 27 Jul 2025 11:31:19 +0200 Subject: [PATCH] =?UTF-8?q?Updated=20Multiselect=20um=20mehrere=20Waren=20?= =?UTF-8?q?angeben=20zu=20k=C3=B6nnen.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- data.db | Bin 12288 -> 12288 bytes main.go | 22 +++++++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/data.db b/data.db index ed3292d5615ab2d3c22fd185459d428a7be4f743..214663054950b54dbef27ecf39e131339b370ae3 100644 GIT binary patch delta 194 zcmZojXh@hK&FDQ*#+lK3W5N=CE@pmL2L4U_HTrI(?85n_p!Z68JXnl zFB^janr1UAV+*)u9v?;CS!G#9ekX^?N93JYJ~Hrs+$^Z@fPZ2DJ3lWY Rvpi#JW?o5AVrqISGXTp^D)#^Y delta 148 zcmZojXh@hK&FC>v#+lJ$W5N=CE=K-M4E&q;H}ZFE7F6)#=htH7WngAzWacnt0D;K| z<%MmH6^sn5jLobJ4b_=B7+6>snK_LaXa70C^y@=|T&5>b*2q-Xz+BhJM8Uws%Gkon r&`iw-X3pf@^4=_;82CQ{&40i@F@T+)mxqyAo-;KwucRn3H9Zvo`+p+_ diff --git a/main.go b/main.go index 282a7d8..46bbf91 100644 --- a/main.go +++ b/main.go @@ -60,7 +60,11 @@ var ( "Terrapin", "Vulture", "Hull-A", "Hull-C", "Zeus ES", "Zeus CL", // …weitere Capital- und Concept-Schiffe sind ebenfalls bekannt! } - waren = []string{"", "Laranite", "Titanium", "Medical Supplies", "Gold", "Agricium", "Hydrogen", "Nitrogen", "Astatine", "Iodine", "Aluminium", "Copper", "Lithium", "Silicon", "Tungsten", "Aphorite", "Beryl", "Bexalite", "Corundum", "Diamond", "Dolivine", "Hadanite", "Hephaestanite", "Laranite", "Quartz", "Taranite"} + waren = []string{ + "", "Laranite", "Titanium", "Medical Supplies", "Gold", "Agricium", "Hydrogen", "Nitrogen", "Astatine", + "Iodine", "Aluminium", "Copper", "Lithium", "Silicon", "Tungsten", "Aphorite", "Beryl", "Bexalite", + "Corundum", "Diamond", "Dolivine", "Hadanite", "Hephaestanite", "Laranite", "Quartz", "Taranite", + } ) type POI struct { @@ -218,8 +222,10 @@ func main() { } orte = append(orte, "") for _, poi := range pois { - formatted := fmt.Sprintf("%s - %s - %s (%s)", poi.System, poi.Planet, poi.PoiName, poi.Type) - orte = append(orte, formatted) + if poi.System == "Stanton" || poi.System == "Pyro" { + formatted := fmt.Sprintf("%s - %s - %s (%s)", poi.System, poi.Planet, poi.PoiName, poi.Type) + orte = append(orte, formatted) + } } // if err != nil { @@ -333,10 +339,11 @@ func main() { startort := r.FormValue("startort") zielort := r.FormValue("zielort") schiff := r.FormValue("schiff") - ware := r.FormValue("ware") + ware := r.Form["ware"] + wareStr := strings.Join(ware, ", ") zeitaufwand, _ := strconv.ParseFloat(r.FormValue("zeitaufwand"), 64) - _, err := db.Exec(`INSERT INTO eintraege (anfangsbestand, endbestand, prozentwert, abgabe, created_at, startort, zielort, schiff, ware, zeitaufwand) VALUES (?, ?, ?, ?, datetime('now'), ?, ?, ?, ?, ?)`, anfang, ende, prozent, abgabe, startort, zielort, schiff, ware, zeitaufwand) + _, err := db.Exec(`INSERT INTO eintraege (anfangsbestand, endbestand, prozentwert, abgabe, created_at, startort, zielort, schiff, ware, zeitaufwand) VALUES (?, ?, ?, ?, datetime('now'), ?, ?, ?, ?, ?)`, anfang, ende, prozent, abgabe, startort, zielort, schiff, wareStr, zeitaufwand) if err != nil { http.Error(w, "Fehler beim Einfügen", http.StatusInternalServerError) return @@ -664,7 +671,7 @@ const htmlTemplate = `
- {{range .Waren}} {{end}} @@ -912,7 +919,8 @@ const htmlTemplate = `