diff --git a/Icon.png b/Icon.png new file mode 100644 index 0000000..5f8dc83 Binary files /dev/null and b/Icon.png differ diff --git a/app.go b/app.go new file mode 100644 index 0000000..a8ac5c2 --- /dev/null +++ b/app.go @@ -0,0 +1,188 @@ +package main + +import ( + "context" + "fmt" + "strconv" + + "github.com/jung-kurt/gofpdf" + "github.com/wailsapp/wails/v2/pkg/runtime" +) + +type App struct { + ctx context.Context + bewertungen []Bewertung + maxPunkte MaxPunkte +} + +func NewApp() *App { + return &App{ + bewertungen: make([]Bewertung, 0), + maxPunkte: MaxPunkte{ + HvMax: 0.00, + HvGewichtung: 0.00, + LvMax: 0.00, + LvGewichtung: 0.00, + }, + } +} + +func (a *App) startup(ctx context.Context) { + a.ctx = ctx +} + +func (a *App) OpenSaveDialog() (string, error) { + return runtime.SaveFileDialog(a.ctx, runtime.SaveDialogOptions{ + DefaultFilename: "bewertungen.pdf", + Filters: []runtime.FileFilter{ + {DisplayName: "PDF Files (*.pdf)", Pattern: "*.pdf"}, + }, + }) +} + +func (a *App) GetBewertungen() []Bewertung { + return a.bewertungen +} + +func (a *App) GetMaxPunkte() MaxPunkte { + return a.maxPunkte +} + +func (a *App) ToggleWertung(id int) Bewertung { + var updatedBewertung Bewertung + for i, bewertung := range a.bewertungen { + if bewertung.ID == id { + a.bewertungen[i].Gewertet = !bewertung.Gewertet + updatedBewertung = a.bewertungen[i] + break + } + } + return updatedBewertung +} + +func (a *App) AddBewertung(vorname, nachname string, hvPunkte, lvPunkte float64) bool { + if !a.validateName(vorname, nachname) { + return false + } + + hvProzent := 100.00 / a.maxPunkte.HvMax * hvPunkte + lvProzent := 100.00 / a.maxPunkte.LvMax * lvPunkte + hvNote := setNote(hvProzent) + lvNote := setNote(lvProzent) + gesamtProzent := hvProzent*a.maxPunkte.HvGewichtung/100 + lvProzent*a.maxPunkte.LvGewichtung/100 + gesamtNote := setNote(gesamtProzent) + + bewertung := Bewertung{ + ID: len(a.bewertungen) + 1, + Vorname: vorname, + Nachname: nachname, + HvPunkte: hvPunkte, + HvProzent: hvProzent, + HvNote: int(hvNote), + LvPunkte: lvPunkte, + LvProzent: lvProzent, + LvNote: int(lvNote), + GesamtProzent: gesamtProzent, + GesamtNote: int(gesamtNote), + Gewertet: true, + } + + a.bewertungen = append(a.bewertungen, bewertung) + return true +} + +func (a *App) SetMaxPunkte(hvMax, lvMax, hvGewichtung, lvGewichtung float64) bool { + if !checkGewichtung(lvGewichtung, hvGewichtung) { + return false + } + + a.maxPunkte = MaxPunkte{ + HvMax: hvMax, + LvMax: lvMax, + HvGewichtung: hvGewichtung, + LvGewichtung: lvGewichtung, + } + return true +} + +func (a *App) ExportBewertungen(path string) error { + pdf := gofpdf.New("P", "mm", "A4", "") + pdf.AddPage() + + // Bewertungen exportieren + pdf.SetFont("Arial", "B", 16) + pdf.CellFormat(0, 10, "Bewertungen", "", 1, "C", false, 0, "") + pdf.Ln(5) + + pdf.SetFont("Arial", "B", 12) + pdf.CellFormat(27, 10, "Vorname", "1", 0, "", false, 0, "") + pdf.CellFormat(27, 10, "Nachname", "1", 0, "", false, 0, "") + pdf.CellFormat(27, 10, "HV-Punkte", "1", 0, "", false, 0, "") + pdf.CellFormat(27, 10, "HV-Note", "1", 0, "", false, 0, "") + pdf.CellFormat(27, 10, "LV-Punkte", "1", 0, "", false, 0, "") + pdf.CellFormat(27, 10, "LV-Note", "1", 0, "", false, 0, "") + pdf.CellFormat(27, 10, "Gesamtnote", "1", 0, "", false, 0, "") + pdf.Ln(-1) + + pdf.SetFont("Arial", "", 11) + for _, bewertung := range a.bewertungen { + if bewertung.Gewertet { + pdf.CellFormat(27, 10, bewertung.Vorname, "1", 0, "", false, 0, "") + pdf.CellFormat(27, 10, bewertung.Nachname, "1", 0, "", false, 0, "") + pdf.CellFormat(27, 10, strconv.FormatFloat(bewertung.HvPunkte, 'f', 2, 64), "1", 0, "", false, 0, "") + pdf.CellFormat(27, 10, strconv.FormatInt(int64(bewertung.HvNote), 10), "1", 0, "", false, 0, "") + pdf.CellFormat(27, 10, strconv.FormatFloat(bewertung.LvPunkte, 'f', 2, 64), "1", 0, "", false, 0, "") + pdf.CellFormat(27, 10, strconv.FormatInt(int64(bewertung.LvNote), 10), "1", 0, "", false, 0, "") + pdf.CellFormat(27, 10, strconv.FormatInt(int64(bewertung.GesamtNote), 10), "1", 0, "", false, 0, "") + pdf.Ln(-1) + } + } + + pdf.AddPage() + pdf.SetFont("Arial", "B", 16) + pdf.CellFormat(0, 10, "Notenspiegel", "", 1, "C", false, 0, "") + pdf.Ln(5) + + notenspiegel := a.GetNotenspiegel() + + pdf.SetFont("Arial", "B", 12) + pdf.CellFormat(30, 10, "Note", "1", 0, "", false, 0, "") + pdf.CellFormat(30, 10, "Anzahl", "1", 0, "", false, 0, "") + pdf.Ln(-1) + + pdf.SetFont("Arial", "", 11) + for note := 1; note <= 6; note++ { + anzahl := notenspiegel[note] + pdf.CellFormat(30, 10, strconv.Itoa(note), "1", 0, "", false, 0, "") + pdf.CellFormat(30, 10, strconv.Itoa(anzahl), "1", 0, "", false, 0, "") + pdf.Ln(-1) + } + + err := pdf.OutputFileAndClose(path) + if err != nil { + fmt.Println("Fehler beim Exportieren der Bewertungen:", err) + return err + } + + runtime.EventsEmit(a.ctx, "export-complete") + return nil +} + +func (a *App) GetNotenspiegel() map[int]int { + notenspiegel := make(map[int]int) + + for _, bewertung := range a.bewertungen { + notenspiegel[bewertung.GesamtNote]++ + } + + return notenspiegel +} + +func (a *App) validateName(vorname, nachname string) bool { + for _, bewertung := range a.bewertungen { + if bewertung.Nachname == nachname && bewertung.Vorname == vorname { + return false + } + } + return true +} diff --git a/frontend/index.html b/frontend/index.html index b77f784..499e2b4 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -1,12 +1,25 @@ - + + - - + + Noten + + + + + -
- + +
+ + + diff --git a/frontend/src/App.svelte b/frontend/src/App.svelte index 1bbfda4..54aa36f 100644 --- a/frontend/src/App.svelte +++ b/frontend/src/App.svelte @@ -1,19 +1,32 @@ -
-
-
-

Arbeit

-
+
+ +
+
+
+

Klassenarbeit-Bewertungssystem

+ +
+ + + -
-
-

Bewertungen

+
+

Bewertungen

- {#if maxPunkte.hvMax === 0} -
-
-
- -
-
- -
-
- -
-
- -
-
- -
-
-
- {/if} -
-
-
- -
-
- -
-
- -
-
- -
-
- -
-
-
+ -
- - - - - - - - - - - - - - - - - - {#each bewertungen as bewertung} - - - - - - - - - - - - - - {/each} - -
GewertetVornameNachnameHV-PunkteHV-ProzentHV-NoteLV-PunkteLV-ProzentLV-NoteGesamt-ProzentGesamt-Note
handleToggleWertung(bewertung.id)}>{bewertung.vorname}{bewertung.nachname}{bewertung.hvPunkte.toFixed(2)}{bewertung.hvProzent.toFixed(2)}{bewertung.hvNote}{bewertung.lvPunkte.toFixed(2)}{bewertung.lvProzent.toFixed(2)}{bewertung.lvNote}{bewertung.gesamtProzent.toFixed(2)}{bewertung.gesamtNote}
-
-

Notenspiegel

- - - - {#each [1,2,3,4,5,6] as note} - - {/each} - - - - - {#each [1,2,3,4,5,6] as note} - {#if notenspiegel[note]} - - {:else} - - {/if} - {/each} - - -
{note}
{notenspiegel[note]}0
+ -
-
- -
-
- -
-
- -
-
-
-
- -
-
+ + + + + +
+
+
diff --git a/frontend/src/BewertungForm.svelte b/frontend/src/BewertungForm.svelte new file mode 100644 index 0000000..74432ac --- /dev/null +++ b/frontend/src/BewertungForm.svelte @@ -0,0 +1,45 @@ + + +
+
+ + + + + +
+
+ diff --git a/frontend/src/BewertungRow.svelte b/frontend/src/BewertungRow.svelte new file mode 100644 index 0000000..d5b11d9 --- /dev/null +++ b/frontend/src/BewertungRow.svelte @@ -0,0 +1,25 @@ + + + + + onToggleWertung(bewertung.id)} + /> + + {bewertung.vorname} + {bewertung.nachname} + {bewertung.hvPunkte.toFixed(2)} + {bewertung.hvProzent.toFixed(2)} + {bewertung.hvNote} + {bewertung.lvPunkte.toFixed(2)} + {bewertung.lvProzent.toFixed(2)} + {bewertung.lvNote} + {bewertung.gesamtProzent.toFixed(2)} + {bewertung.gesamtNote} + diff --git a/frontend/src/BewertungenTable.svelte b/frontend/src/BewertungenTable.svelte new file mode 100644 index 0000000..dc8cfef --- /dev/null +++ b/frontend/src/BewertungenTable.svelte @@ -0,0 +1,39 @@ + + +
+ + + + + + + + + + + + + + + + + + + + {#each bewertungen as bewertung (bewertung.id)} + + {/each} + +
GewertetVornameNachnameHV-PunkteHV-ProzentHV-NoteLV-PunkteLV-ProzentLV-NoteGesamt-ProzentGesamt-Note
+
+ + + + + + + diff --git a/frontend/src/ExportSection.svelte b/frontend/src/ExportSection.svelte new file mode 100644 index 0000000..485222e --- /dev/null +++ b/frontend/src/ExportSection.svelte @@ -0,0 +1,16 @@ + + +
+ + + +
diff --git a/frontend/src/MaxPunkteForm.svelte b/frontend/src/MaxPunkteForm.svelte new file mode 100644 index 0000000..4c10be6 --- /dev/null +++ b/frontend/src/MaxPunkteForm.svelte @@ -0,0 +1,52 @@ + + +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+
diff --git a/frontend/src/Notenspiegel.svelte b/frontend/src/Notenspiegel.svelte new file mode 100644 index 0000000..d495f85 --- /dev/null +++ b/frontend/src/Notenspiegel.svelte @@ -0,0 +1,23 @@ + + +

Notenspiegel

+
+ + + + {#each [1, 2, 3, 4, 5, 6] as note} + + {/each} + + + + + {#each [1, 2, 3, 4, 5, 6] as note} + + {/each} + + +
{note}
{notenspiegel[note] || 0}
+
diff --git a/frontend/src/ThemeSwitcher.svelte b/frontend/src/ThemeSwitcher.svelte new file mode 100644 index 0000000..2b114c7 --- /dev/null +++ b/frontend/src/ThemeSwitcher.svelte @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/main.go b/main.go index 657205a..cf08bc5 100644 --- a/main.go +++ b/main.go @@ -2,213 +2,18 @@ package main import ( - "context" "embed" "fmt" - "strconv" - "github.com/jung-kurt/gofpdf" "github.com/wailsapp/wails/v2" + "github.com/wailsapp/wails/v2/pkg/logger" "github.com/wailsapp/wails/v2/pkg/options" "github.com/wailsapp/wails/v2/pkg/options/assetserver" - "github.com/wailsapp/wails/v2/pkg/runtime" + "github.com/wailsapp/wails/v2/pkg/options/linux" + "github.com/wailsapp/wails/v2/pkg/options/mac" + "github.com/wailsapp/wails/v2/pkg/options/windows" ) -type Bewertung struct { - Vorname string `json:"vorname"` - Nachname string `json:"nachname"` - ID int `json:"id"` - HvPunkte float64 `json:"hvPunkte"` - HvProzent float64 `json:"hvProzent"` - HvNote int `json:"hvNote"` - LvPunkte float64 `json:"lvPunkte"` - LvProzent float64 `json:"lvProzent"` - LvNote int `json:"lvNote"` - GesamtProzent float64 `json:"gesamtProzent"` - GesamtNote int `json:"gesamtNote"` - Gewertet bool `json:"gewertet"` -} - -type MaxPunkte struct { - HvMax float64 `json:"hvMax"` - LvMax float64 `json:"lvMax"` - HvGewichtung float64 `json:"hvGewichtung"` - LvGewichtung float64 `json:"lvGewichtung"` -} - -type App struct { - ctx context.Context - bewertungen []Bewertung - maxPunkte MaxPunkte -} - -func NewApp() *App { - return &App{ - bewertungen: make([]Bewertung, 0), - maxPunkte: MaxPunkte{ - HvMax: 0.00, - HvGewichtung: 0.00, - LvMax: 0.00, - LvGewichtung: 0.00, - }, - } -} - -func (a *App) startup(ctx context.Context) { - a.ctx = ctx -} - -func (a *App) GetBewertungen() []Bewertung { - return a.bewertungen -} - -func (a *App) GetMaxPunkte() MaxPunkte { - return a.maxPunkte -} - -func (a *App) ToggleWertung(id int) Bewertung { - var updatedBewertung Bewertung - for i, bewertung := range a.bewertungen { - if bewertung.ID == id { - a.bewertungen[i].Gewertet = !bewertung.Gewertet - updatedBewertung = a.bewertungen[i] - break - } - } - return updatedBewertung -} - -func (a *App) AddBewertung(vorname, nachname string, hvPunkte, lvPunkte float64) bool { - if !a.validateName(vorname, nachname) { - return false - } - - hvProzent := 100.00 / a.maxPunkte.HvMax * hvPunkte - lvProzent := 100.00 / a.maxPunkte.LvMax * lvPunkte - hvNote := setNote(hvProzent) - lvNote := setNote(lvProzent) - gesamtProzent := hvProzent*a.maxPunkte.HvGewichtung/100 + lvProzent*a.maxPunkte.LvGewichtung/100 - gesamtNote := setNote(gesamtProzent) - - bewertung := Bewertung{ - ID: len(a.bewertungen) + 1, - Vorname: vorname, - Nachname: nachname, - HvPunkte: hvPunkte, - HvProzent: hvProzent, - HvNote: int(hvNote), - LvPunkte: lvPunkte, - LvProzent: lvProzent, - LvNote: int(lvNote), - GesamtProzent: gesamtProzent, - GesamtNote: int(gesamtNote), - Gewertet: true, - } - - a.bewertungen = append(a.bewertungen, bewertung) - return true -} - -func (a *App) SetMaxPunkte(hvMax, lvMax, hvGewichtung, lvGewichtung float64) bool { - if !checkGewichtung(lvGewichtung, hvGewichtung) { - return false - } - - a.maxPunkte = MaxPunkte{ - HvMax: hvMax, - LvMax: lvMax, - HvGewichtung: hvGewichtung, - LvGewichtung: lvGewichtung, - } - return true -} - -func (a *App) ExportBewertungen(path string) error { - pdf := gofpdf.New("P", "mm", "A4", "") - pdf.AddPage() - - pdf.SetFont("Arial", "B", 12) - pdf.CellFormat(27, 10, "Vorname", "1", 0, "", false, 0, "") - pdf.CellFormat(27, 10, "Nachname", "1", 0, "", false, 0, "") - pdf.CellFormat(27, 10, "HV-Punkte", "1", 0, "", false, 0, "") - pdf.CellFormat(27, 10, "HV-Note", "1", 0, "", false, 0, "") - pdf.CellFormat(27, 10, "LV-Punkte", "1", 0, "", false, 0, "") - pdf.CellFormat(27, 10, "LV-Note", "1", 0, "", false, 0, "") - pdf.CellFormat(27, 10, "Gesamtnote", "1", 0, "", false, 0, "") - pdf.Ln(-1) - - pdf.SetFont("Arial", "", 11) - for _, bewertung := range a.bewertungen { - pdf.CellFormat(27, 10, bewertung.Vorname, "1", 0, "", false, 0, "") - pdf.CellFormat(27, 10, bewertung.Nachname, "1", 0, "", false, 0, "") - pdf.CellFormat(27, 10, strconv.FormatFloat(bewertung.HvPunkte, 'f', 2, 64), "1", 0, "", false, 0, "") - pdf.CellFormat(27, 10, strconv.FormatInt(int64(bewertung.HvNote), 10), "1", 0, "", false, 0, "") - pdf.CellFormat(27, 10, strconv.FormatFloat(bewertung.LvPunkte, 'f', 2, 64), "1", 0, "", false, 0, "") - pdf.CellFormat(27, 10, strconv.FormatInt(int64(bewertung.LvNote), 10), "1", 0, "", false, 0, "") - pdf.CellFormat(27, 10, strconv.FormatInt(int64(bewertung.GesamtNote), 10), "1", 0, "", false, 0, "") - pdf.Ln(-1) - } - - err := pdf.OutputFileAndClose(path) - if err != nil { - fmt.Println("Fehler beim Exportieren der Bewertungen:", err) - return err - } - - runtime.EventsEmit(a.ctx, "export-complete") - return nil -} - -func (a *App) GetNotenspiegel() map[int]int { - notenspiegel := make(map[int]int) - - for _, bewertung := range a.bewertungen { - notenspiegel[bewertung.GesamtNote]++ - } - - return notenspiegel -} - -func (a *App) validateName(vorname, nachname string) bool { - for _, bewertung := range a.bewertungen { - if bewertung.Nachname == nachname && bewertung.Vorname == vorname { - return false - } - } - return true -} - -func setNote(prozent float64) float64 { - switch { - case prozent <= 22: - return 6.00 - case prozent <= 49: - return 5.00 - case prozent <= 64: - return 4.00 - case prozent <= 79: - return 3.00 - case prozent <= 94: - return 2.00 - default: - return 1.00 - } -} - -func checkGewichtung(lv, hv float64) bool { - sum := hv/100 + lv/100 - return sum == 1 -} - -func (a *App) OpenSaveDialog() (string, error) { - return runtime.SaveFileDialog(a.ctx, runtime.SaveDialogOptions{ - DefaultFilename: "bewertungen.pdf", - Filters: []runtime.FileFilter{ - {DisplayName: "PDF Files (*.pdf)", Pattern: "*.pdf"}, - }, - }) -} - //go:embed all:frontend/dist var assets embed.FS @@ -216,19 +21,65 @@ func main() { app := NewApp() err := wails.Run(&options.App{ - Title: "Bewertungen", - Width: 1024, - Height: 768, - MinWidth: 1024, - MinHeight: 768, + Title: "Notenverwaltung", + Width: 1400, + Height: 1000, + MinWidth: 1200, + MinHeight: 1000, + DisableResize: false, + Fullscreen: false, + WindowStartState: options.Maximised, + StartHidden: false, + HideWindowOnClose: false, AssetServer: &assetserver.Options{ Assets: assets, }, - BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 1}, - OnStartup: app.startup, + Logger: nil, + LogLevel: logger.DEBUG, + LogLevelProduction: logger.ERROR, + BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 1}, + OnStartup: app.startup, Bind: []interface{}{ app, }, + EnableDefaultContextMenu: false, + EnableFraudulentWebsiteDetection: false, + Windows: &windows.Options{ + WebviewIsTransparent: false, + WindowIsTranslucent: false, + BackdropType: windows.Mica, + DisablePinchZoom: false, + DisableWindowIcon: false, + DisableFramelessWindowDecorations: false, + WebviewUserDataPath: "", + WebviewBrowserPath: "", + Theme: windows.SystemDefault, + }, + Mac: &mac.Options{ + TitleBar: &mac.TitleBar{ + TitlebarAppearsTransparent: true, + HideTitle: false, + HideTitleBar: false, + FullSizeContent: false, + UseToolbar: false, + HideToolbarSeparator: true, + }, + Appearance: mac.NSAppearanceNameDarkAqua, + WebviewIsTransparent: true, + WindowIsTranslucent: false, + About: &mac.AboutInfo{ + Title: "Notenverwaltung", + Message: "© 2024 Pata1704", + }, + }, + Linux: &linux.Options{ + WindowIsTranslucent: false, + WebviewGpuPolicy: linux.WebviewGpuPolicyAlways, + ProgramName: "Notenverwaltung", + }, + Debug: options.Debug{ + OpenInspectorOnStartup: false, + }, }) if err != nil { fmt.Println("Error:", err) diff --git a/models.go b/models.go new file mode 100644 index 0000000..feca993 --- /dev/null +++ b/models.go @@ -0,0 +1,23 @@ +package main + +type Bewertung struct { + Vorname string `json:"vorname"` + Nachname string `json:"nachname"` + ID int `json:"id"` + HvPunkte float64 `json:"hvPunkte"` + HvProzent float64 `json:"hvProzent"` + HvNote int `json:"hvNote"` + LvPunkte float64 `json:"lvPunkte"` + LvProzent float64 `json:"lvProzent"` + LvNote int `json:"lvNote"` + GesamtProzent float64 `json:"gesamtProzent"` + GesamtNote int `json:"gesamtNote"` + Gewertet bool `json:"gewertet"` +} + +type MaxPunkte struct { + HvMax float64 `json:"hvMax"` + LvMax float64 `json:"lvMax"` + HvGewichtung float64 `json:"hvGewichtung"` + LvGewichtung float64 `json:"lvGewichtung"` +} diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..aefeaf6 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,171 @@ +{ + "name": "Noten", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "devDependencies": { + "daisyui": "^4.12.14" + } + }, + "node_modules/camelcase-css": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/camelcase-css/-/camelcase-css-2.0.1.tgz", + "integrity": "sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/css-selector-tokenizer": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/css-selector-tokenizer/-/css-selector-tokenizer-0.8.0.tgz", + "integrity": "sha512-Jd6Ig3/pe62/qe5SBPTN8h8LeUg/pT4lLgtavPf7updwwHpvFzxvOQBHYj2LZDMjUnBzgvIUSjRcf6oT5HzHFg==", + "dev": true, + "license": "MIT", + "dependencies": { + "cssesc": "^3.0.0", + "fastparse": "^1.1.2" + } + }, + "node_modules/cssesc": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", + "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", + "dev": true, + "license": "MIT", + "bin": { + "cssesc": "bin/cssesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/culori": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/culori/-/culori-3.3.0.tgz", + "integrity": "sha512-pHJg+jbuFsCjz9iclQBqyL3B2HLCBF71BwVNujUYEvCeQMvV97R59MNK3R2+jgJ3a1fcZgI9B3vYgz8lzr/BFQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + } + }, + "node_modules/daisyui": { + "version": "4.12.14", + "resolved": "https://registry.npmjs.org/daisyui/-/daisyui-4.12.14.tgz", + "integrity": "sha512-hA27cdBasdwd4/iEjn+aidoCrRroDuo3G5W9NDKaVCJI437Mm/3eSL/2u7MkZ0pt8a+TrYF3aT2pFVemTS3how==", + "dev": true, + "license": "MIT", + "dependencies": { + "css-selector-tokenizer": "^0.8", + "culori": "^3", + "picocolors": "^1", + "postcss-js": "^4" + }, + "engines": { + "node": ">=16.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/daisyui" + } + }, + "node_modules/fastparse": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/fastparse/-/fastparse-1.1.2.tgz", + "integrity": "sha512-483XLLxTVIwWK3QTrMGRqUfUpoOs/0hbQrl2oz4J0pAcm3A3bu84wxTFqGqkJzewCLdME38xJLJAxBABfQT8sQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/nanoid": { + "version": "3.3.8", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz", + "integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "peer": true, + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/postcss": { + "version": "8.4.49", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.49.tgz", + "integrity": "sha512-OCVPnIObs4N29kxTjzLfUryOkvZEq+pf8jTF0lg8E7uETuWHA+v7j3c/xJmiqpX450191LlmZfUKkXxkTry7nA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "peer": true, + "dependencies": { + "nanoid": "^3.3.7", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/postcss-js": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/postcss-js/-/postcss-js-4.0.1.tgz", + "integrity": "sha512-dDLF8pEO191hJMtlHFPRa8xsizHaM82MLfNkUHdUtVEV3tgTp5oj+8qbEqYM57SLfc74KSbw//4SeJma2LRVIw==", + "dev": true, + "license": "MIT", + "dependencies": { + "camelcase-css": "^2.0.1" + }, + "engines": { + "node": "^12 || ^14 || >= 16" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + "peerDependencies": { + "postcss": "^8.4.21" + } + }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..9ca9ff7 --- /dev/null +++ b/package.json @@ -0,0 +1,5 @@ +{ + "devDependencies": { + "daisyui": "^4.12.14" + } +} diff --git a/utils.go b/utils.go new file mode 100644 index 0000000..e4cc620 --- /dev/null +++ b/utils.go @@ -0,0 +1,23 @@ +package main + +func setNote(prozent float64) float64 { + switch { + case prozent <= 22: + return 6.00 + case prozent <= 49: + return 5.00 + case prozent <= 64: + return 4.00 + case prozent <= 79: + return 3.00 + case prozent <= 94: + return 2.00 + default: + return 1.00 + } +} + +func checkGewichtung(lv, hv float64) bool { + sum := hv/100 + lv/100 + return sum == 1 +}