v0.2.1 — Code Review Fixes

Fixes:
- CRITICAL: compareVersions used string comparison, fails for 1.10 vs 1.9 (now numeric)
- CRITICAL: Double CloseDatabase() in main.go (defer + OnShutdown)
- CRITICAL: Tailwind v4 in package.json but v3 config/syntax (downgraded to v3)
- CRITICAL: react-router-dom v7 with v5 types (switched to v6, removed deprecated types)
- IMPORTANT: UpdatePlanEntry hook signature mismatch (7 args vs Go's 4)
- IMPORTANT: AllergenPicker hidden checkbox inaccessible to screenreaders (sr-only)
- IMPORTANT: weekHelper getWeekFromDate returned wrong ISO year for edge cases
- IMPORTANT: getWeeksInYear bug for years where Dec 31 is in week 1 of next year
- IMPORTANT: getDateFromWeek off-by-one for some years (use Jan 4 anchor)
- IMPORTANT: ProductSearch click-outside missed dropdown (use container ref)
- IMPORTANT: seed.go LastInsertId=0 on INSERT OR IGNORE skip
- IMPORTANT: SQLite missing PRAGMA foreign_keys=ON and WAL mode
- IMPORTANT: AdditivePicker ADDITIVE_NAMES used numeric IDs but data uses letters
- IMPORTANT: Missing role=dialog/aria-modal on all modal dialogs
- IMPORTANT: Missing Escape key handler on ProductForm modal
- IMPORTANT: Sidebar NavLink aria-current used function instead of string
- IMPORTANT: useProducts searchProducts null safety for allergens/additives
- NICE-TO-HAVE: Added aria-live=polite to WeekPlanner for dynamic updates
- NICE-TO-HAVE: Added postcss.config.js for Tailwind v3
- NICE-TO-HAVE: Updated model comments to match actual day/meal conventions
- NICE-TO-HAVE: Modernized vite/typescript/plugin versions
This commit is contained in:
clawd
2026-02-20 10:11:54 +00:00
parent e146442513
commit df9e7c5541
17 changed files with 98 additions and 84 deletions

View File

@@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"net/http"
"strconv"
"strings"
"time"
)
@@ -79,7 +80,7 @@ func (u *Updater) DownloadUpdate(downloadURL string) error {
// compareVersions vergleicht zwei Versionsstrings
// Gibt -1 zurück wenn v1 < v2, 0 wenn v1 == v2, 1 wenn v1 > v2
func compareVersions(v1, v2 string) int {
// Vereinfachter Versionsvergleich (nur für grundlegende Semantic Versioning)
// Semantic Versioning Vergleich mit numerischem Parsing
v1Parts := strings.Split(strings.TrimPrefix(v1, "v"), ".")
v2Parts := strings.Split(strings.TrimPrefix(v2, "v"), ".")
@@ -92,11 +93,22 @@ func compareVersions(v1, v2 string) int {
}
for i := 0; i < 3; i++ {
// Einfacher String-Vergleich (funktioniert für einstellige Zahlen)
if v1Parts[i] < v2Parts[i] {
n1, err1 := strconv.Atoi(v1Parts[i])
n2, err2 := strconv.Atoi(v2Parts[i])
if err1 != nil || err2 != nil {
// Fallback auf String-Vergleich
if v1Parts[i] < v2Parts[i] {
return -1
}
if v1Parts[i] > v2Parts[i] {
return 1
}
continue
}
if n1 < n2 {
return -1
}
if v1Parts[i] > v2Parts[i] {
if n1 > n2 {
return 1
}
}