Compare commits

...

11 commits
v0.1.0 ... main

22 changed files with 1003 additions and 445 deletions

6
.idea/vcs.xml generated Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

16
.idea/workspace.xml generated
View file

@ -4,16 +4,22 @@
<option name="autoReloadType" value="ALL" />
</component>
<component name="ChangeListManager">
<list default="true" id="2cf4f7d3-9cc0-48e5-b86e-45d2370fc4b4" name="Changes" comment="" />
<list default="true" id="2cf4f7d3-9cc0-48e5-b86e-45d2370fc4b4" name="Changes" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/frontend/src/App.svelte" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/src/App.svelte" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="GOROOT" url="file:///usr/lib/go" />
<component name="ProjectColorInfo"><![CDATA[{
"associatedIndex": 1
}]]></component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="ProjectColorInfo">{
&quot;associatedIndex&quot;: 1
}</component>
<component name="ProjectId" id="2pLiKsaGzDB4fYzIPjPUwqkJw4g" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
@ -22,9 +28,11 @@
<component name="PropertiesComponent"><![CDATA[{
"keyToString": {
"RunOnceActivity.ShowReadmeOnStart": "true",
"RunOnceActivity.git.unshallow": "true",
"RunOnceActivity.go.formatter.settings.were.checked": "true",
"RunOnceActivity.go.migrated.go.modules.settings": "true",
"RunOnceActivity.go.modules.go.list.on.any.changes.was.set": "true",
"git-widget-placeholder": "main",
"go.import.settings.migrated": "true",
"go.sdk.automatically.set": "true",
"last_opened_file_path": "/home/pata/dev/learn/Go/Noten",

BIN
Icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

220
app.go Normal file
View file

@ -0,0 +1,220 @@
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
}
var (
gesamtNote float64
gesamtProzent float64
)
lvNote := 0.0
lvProzent := 0.0
hvProzent := 100.00 / a.maxPunkte.HvMax * hvPunkte
hvNote := setNote(hvProzent)
if a.maxPunkte.LvMax != 0 {
lvProzent = 100.00 / a.maxPunkte.LvMax * lvPunkte
lvNote = setNote(lvProzent)
gesamtProzent = hvProzent*a.maxPunkte.HvGewichtung/100 + lvProzent*a.maxPunkte.LvGewichtung/100
gesamtNote = setNote(gesamtProzent)
} else {
gesamtProzent = hvProzent * a.maxPunkte.HvGewichtung / 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", 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)
}
var gesamtSumme float64
var anzahlGewertet int
var anzahlUnterSchnitt int
for _, bewertung := range a.bewertungen {
if bewertung.Gewertet {
gesamtSumme += float64(bewertung.GesamtNote)
anzahlGewertet++
if bewertung.GesamtNote >= 5 {
anzahlUnterSchnitt++
}
}
}
gesamtSchnitt := gesamtSumme / float64(anzahlGewertet)
prozentUnterSchnitt := float64(anzahlUnterSchnitt) / float64(anzahlGewertet) * 100
pdf.Ln(10)
pdf.SetFont("Arial", "B", 12)
pdf.CellFormat(0, 10, fmt.Sprintf("Gesamtnotenschnitt: %.2f", gesamtSchnitt), "", 1, "", false, 0, "")
pdf.CellFormat(0, 10, fmt.Sprintf("Prozentsatz der Bewertungen unter dem Schnitt (Note 5 oder 6): %.2f%%", prozentUnterSchnitt), "", 1, "", false, 0, "")
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
}

View file

@ -2,6 +2,42 @@
All notable changes to this project will be documented in this file.
## [0.2.0] - 2024-11-29
### 🚀 Features
- Add Notendurschnitt and Prozent unter Schnitt to exported pdf
## [0.1.3] - 2024-11-28
### 🐛 Bug Fixes
- Fix error supporting half points
### 📚 Documentation
- Update changelog.md
## [0.1.2] - 2024-11-28
### 🐛 Bug Fixes
- Fix error calculating grade
### 📚 Documentation
- Update changelog.md
## [0.1.1] - 2024-11-28
### 🚜 Refactor
- Seperate code into different files
### 📚 Documentation
- Update changelog.md
## [0.1.0] - 2024-11-25
### 🐛 Bug Fixes
@ -11,4 +47,8 @@ All notable changes to this project will be documented in this file.
- Fix build failure
- Next try fixing build process
### 📚 Documentation
- Add changelog
<!-- generated by git-cliff -->

View file

@ -1,12 +1,25 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
<meta charset="UTF-8" />
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<title>Noten</title>
<link href="https://cdn.jsdelivr.net/npm/daisyui@4.12.14/dist/full.min.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@catppuccin/daisyui@1.2.1/dist/catppuccin.css" />
<script src="https://cdn.tailwindcss.com"></script>
</head>
<body>
<div id="app"></div>
<script src="./src/main.js" type="module"></script>
<!-- <div data-theme="macchiato" id="app"></div> -->
<div id="app"></div>
<script>
// Set initial theme based on user preference or default
const initialTheme = localStorage.getItem("theme") || "macchiato";
document.getElementById("app").setAttribute("data-theme", initialTheme);
</script>
<script src="./src/main.js" type="module"></script>
</body>
</html>

View file

@ -1,19 +1,32 @@
<script>
import { onMount } from 'svelte';
import { AddBewertung, GetBewertungen, GetMaxPunkte, SetMaxPunkte, ToggleWertung, ExportBewertungen, GetNotenspiegel } from '../wailsjs/go/main/App';
import { OpenSaveDialog } from '../wailsjs/go/main/App';
import 'bulma/css/bulma.min.css';
import { onMount } from "svelte";
import {
AddBewertung,
GetBewertungen,
GetMaxPunkte,
SetMaxPunkte,
ToggleWertung,
ExportBewertungen,
GetNotenspiegel,
} from "../wailsjs/go/main/App";
import { OpenSaveDialog } from "../wailsjs/go/main/App";
import MaxPunkteForm from "./MaxPunkteForm.svelte";
import BewertungForm from "./BewertungForm.svelte";
import BewertungenTable from "./BewertungenTable.svelte";
import Notenspiegel from "./Notenspiegel.svelte";
import ExportSection from "./ExportSection.svelte";
import ThemeSwitcher from "./ThemeSwitcher.svelte";
let bewertungen = [];
let maxPunkte = {
hvMax: 0,
lvMax: 0,
hvGewichtung: 0,
lvGewichtung: 0
lvGewichtung: 0,
};
let vorname = '';
let nachname = '';
let vorname = "";
let nachname = "";
let hvPunkte = 0;
let lvPunkte = 0;
let hvMax = 0;
@ -21,8 +34,8 @@
let hvGewichtung = 0;
let lvGewichtung = 0;
let exportPath = '';
let notenspiegel = {}
let exportPath = "";
let notenspiegel = {};
onMount(async () => {
await loadData();
@ -32,22 +45,24 @@
async function loadData() {
bewertungen = await GetBewertungen();
maxPunkte = await GetMaxPunkte();
if (maxPunkte.hvMax === 0) {
hvMax = maxPunkte.hvMax;
lvMax = maxPunkte.lvMax;
hvGewichtung = maxPunkte.hvGewichtung;
lvGewichtung = maxPunkte.lvGewichtung;
}
hvMax = maxPunkte.hvMax;
lvMax = maxPunkte.lvMax;
hvGewichtung = maxPunkte.hvGewichtung;
lvGewichtung = maxPunkte.lvGewichtung;
}
async function handleAddBewertung() {
const success = await AddBewertung(vorname, nachname, hvPunkte, lvPunkte);
if (success) {
await loadData();
resetForm();
await loadNotenspiegel();
if (maxPunkte.hvMax !== 0 && maxPunkte.hvGewichtung !== 0) {
const success = await AddBewertung(vorname, nachname, hvPunkte, lvPunkte);
if (success) {
await loadData();
resetForm();
await loadNotenspiegel();
} else {
alert("Name existiert bereits!");
}
} else {
alert('Name existiert bereits!');
alert("Max Punkte muss befüllt sein");
}
}
@ -55,12 +70,37 @@
notenspiegel = await GetNotenspiegel();
}
async function handleSetMaxPunkte() {
const success = await SetMaxPunkte(hvMax, lvMax, hvGewichtung, lvGewichtung);
if (!success) {
alert('Ungültige Gewichtung! Die Summe muss 100% ergeben.');
let isMaxPunkteValid = false;
function validateMaxPunkte() {
if (hvMax > 0 && lvMax === 0) {
isMaxPunkteValid = hvGewichtung === 100;
} else if (hvMax > 0 && lvMax > 0) {
isMaxPunkteValid = hvGewichtung + lvGewichtung === 100;
} else {
await loadData();
isMaxPunkteValid = false;
}
}
$: {
validateMaxPunkte();
}
async function handleSetMaxPunkte() {
validateMaxPunkte();
if (isMaxPunkteValid) {
const success = await SetMaxPunkte(
hvMax,
lvMax,
hvGewichtung,
lvGewichtung,
);
if (success) {
await loadData();
} else {
alert("Es gab einen Fehler beim Setzen der Max-Punkte.");
}
}
}
@ -75,149 +115,68 @@
exportPath = result;
}
} catch (error) {
console.error('Fehler beim Öffnen des Dateiauswahldialogs:', error);
console.error("Fehler beim Öffnen des Dateiauswahldialogs:", error);
}
}
async function handleExport() {
if (!exportPath) {
alert('Bitte wählen Sie einen Speicherpfad aus.');
alert("Bitte wählen Sie einen Speicherpfad aus.");
return;
}
await ExportBewertungen(exportPath);
alert('Export abgeschlossen!');
alert("Export abgeschlossen!");
}
function resetForm() {
vorname = '';
nachname = '';
vorname = "";
nachname = "";
hvPunkte = 0;
lvPunkte = 0;
}
</script>
<div class="container is-widescreen">
<div class="card">
<header class="card-header">
<p class="card-header-title">Arbeit</p>
</header>
<div class="container mx-auto p-4">
<!-- <ThemeSwitcher /> -->
<div class="card bg-base-100 shadow-xl">
<div class="card-body">
<div class="flex justify-between items-center mb-6">
<h1 class="text-3xl font-bold">Klassenarbeit-Bewertungssystem</h1>
<ThemeSwitcher />
</div>
<!-- <h1 class="text-3xl font-bold text-center mb-6"> -->
<!-- Klassenarbeit-Bewertungssystem -->
<!-- </h1> -->
<div class="card-content">
<div class="content">
<h1 class="title">Bewertungen</h1>
<div class="divider"></div>
<h3 class="text-2xl font-bold mb-4">Bewertungen</h3>
{#if maxPunkte.hvMax === 0}
<form on:submit|preventDefault={handleSetMaxPunkte}>
<div class="field is-grouped">
<div class="control">
<input class="input" type="number" bind:value={hvMax} placeholder="HV-Max-Punkte" required>
</div>
<div class="control">
<input class="input" type="number" bind:value={hvGewichtung} placeholder="HV-Gewichtung in %" required>
</div>
<div class="control">
<input class="input" type="number" bind:value={lvMax} placeholder="LV-Max-Punkte" required>
</div>
<div class="control">
<input class="input" type="number" bind:value={lvGewichtung} placeholder="LV-Gewichtung in %" required>
</div>
<div class="control">
<button type="submit" class="button is-primary">Setzen</button>
</div>
</div>
</form>
{/if}
<form on:submit|preventDefault={handleAddBewertung}>
<div class="field is-grouped">
<div class="control">
<input class="input" type="text" bind:value={vorname} placeholder="Vorname" required>
</div>
<div class="control">
<input class="input" type="text" bind:value={nachname} placeholder="Nachname" required>
</div>
<div class="control">
<input class="input" type="number" bind:value={hvPunkte} placeholder="HV-Punkte" required>
</div>
<div class="control">
<input class="input" type="number" bind:value={lvPunkte} placeholder="LV-Punkte" required>
</div>
<div class="control">
<button type="submit" class="button is-primary">Hinzufügen</button>
</div>
</div>
</form>
<MaxPunkteForm
bind:hvMax
bind:lvMax
bind:hvGewichtung
bind:lvGewichtung
onSubmit={handleSetMaxPunkte}
/>
<div class="table-container">
<table class="table is-hoverable is-fullwidth">
<thead>
<tr>
<th>Gewertet</th>
<th>Vorname</th>
<th>Nachname</th>
<th>HV-Punkte</th>
<th>HV-Prozent</th>
<th>HV-Note</th>
<th>LV-Punkte</th>
<th>LV-Prozent</th>
<th>LV-Note</th>
<th>Gesamt-Prozent</th>
<th>Gesamt-Note</th>
</tr>
</thead>
<tbody>
{#each bewertungen as bewertung}
<tr>
<td><input type="checkbox" checked={bewertung.gewertet} on:change={() => handleToggleWertung(bewertung.id)}></td>
<td>{bewertung.vorname}</td>
<td>{bewertung.nachname}</td>
<td>{bewertung.hvPunkte.toFixed(2)}</td>
<td>{bewertung.hvProzent.toFixed(2)}</td>
<td>{bewertung.hvNote}</td>
<td>{bewertung.lvPunkte.toFixed(2)}</td>
<td>{bewertung.lvProzent.toFixed(2)}</td>
<td>{bewertung.lvNote}</td>
<td>{bewertung.gesamtProzent.toFixed(2)}</td>
<td>{bewertung.gesamtNote}</td>
</tr>
{/each}
</tbody>
</table>
</div>
<h2 class="title">Notenspiegel</h2>
<table class="table is-hoverable is-fullwidth">
<thead>
<tr>
{#each [1,2,3,4,5,6] as note}
<th>{note}</th>
{/each}
</tr>
</thead>
<tbody>
<tr>
{#each [1,2,3,4,5,6] as note}
{#if notenspiegel[note]}
<td>{notenspiegel[note]}</td>
{:else}
<td>0</td>
{/if}
{/each}
</tr>
</tbody>
</table>
<BewertungForm
bind:vorname
bind:nachname
bind:hvPunkte
bind:lvPunkte
onSubmit={handleAddBewertung}
disabled={!isMaxPunkteValid}
/>
<div class="field is-grouped">
<div class="control">
<input type="text" class="input" bind:value={exportPath} readonly>
</div>
<div class="control">
<button class="button is-info" on:click={selectExportPath}>Pfad auswählen</button>
</div>
<div class="control">
<button class="button is-info" on:click={handleExport}>Exportieren</button>
</div>
</div>
</div> <!-- content -->
</div> <!-- card-content -->
</div> <!-- card -->
</div> <!-- container -->
<BewertungenTable {bewertungen} onToggleWertung={handleToggleWertung} />
<Notenspiegel {notenspiegel} />
<ExportSection
bind:exportPath
onSelectPath={selectExportPath}
onExport={handleExport}
/>
</div>
</div>
</div>

View file

@ -0,0 +1,46 @@
<script>
export let vorname;
export let nachname;
export let hvPunkte;
export let lvPunkte;
export let onSubmit;
export let disabled = false;
</script>
<form on:submit|preventDefault={onSubmit} class="mb-4">
<div class="flex flex-wrap gap-2">
<input
class="input input-bordered"
type="text"
bind:value={vorname}
placeholder="Vorname"
required
/>
<input
class="input input-bordered"
type="text"
bind:value={nachname}
placeholder="Nachname"
required
/>
<input
class="input input-bordered"
type="number"
step="0.5"
bind:value={hvPunkte}
placeholder="HV-Punkte"
required
/>
<input
class="input input-bordered"
type="number"
step="0.5"
bind:value={lvPunkte}
placeholder="LV-Punkte"
required
/>
<button type="submit" class="btn btn-primary" {disabled}>
Hinzufügen
</button>
</div>
</form>

View file

@ -0,0 +1,25 @@
<script>
export let bewertung;
export let onToggleWertung;
</script>
<tr>
<td>
<input
type="checkbox"
class="toggle"
checked={bewertung.gewertet}
on:change={() => onToggleWertung(bewertung.id)}
/>
</td>
<td>{bewertung.vorname}</td>
<td>{bewertung.nachname}</td>
<td>{bewertung.hvPunkte.toFixed(2)}</td>
<td>{bewertung.hvProzent.toFixed(2)}</td>
<td>{bewertung.hvNote}</td>
<td>{bewertung.lvPunkte.toFixed(2)}</td>
<td>{bewertung.lvProzent.toFixed(2)}</td>
<td>{bewertung.lvNote}</td>
<td>{bewertung.gesamtProzent.toFixed(2)}</td>
<td>{bewertung.gesamtNote}</td>
</tr>

View file

@ -0,0 +1,39 @@
<script>
import BewertungRow from "./BewertungRow.svelte";
export let bewertungen;
export let onToggleWertung;
</script>
<div class="max-h-[500px] overflow-y-auto overflow-x-auto">
<table class="table w-full">
<!-- <div class="overflow-x-auto overflow-y auto"> -->
<!-- <table class="table w-full table-container"> -->
<thead>
<tr>
<th>Gewertet</th>
<th>Vorname</th>
<th>Nachname</th>
<th>HV-Punkte</th>
<th>HV-Prozent</th>
<th>HV-Note</th>
<th>LV-Punkte</th>
<th>LV-Prozent</th>
<th>LV-Note</th>
<th>Gesamt-Prozent</th>
<th>Gesamt-Note</th>
</tr>
</thead>
<tbody>
{#each bewertungen as bewertung (bewertung.id)}
<BewertungRow {bewertung} {onToggleWertung} />
{/each}
</tbody>
</table>
</div>
<!-- <style> -->
<!-- .table-container { -->
<!-- max-height: 400px; -->
<!-- overflow-y: auto; -->
<!-- } -->
<!-- </style> -->

View file

@ -0,0 +1,16 @@
<script>
export let exportPath;
export let onSelectPath;
export let onExport;
</script>
<div class="flex flex-wrap gap-2 mt-4">
<input
type="text"
class="input input-bordered flex-grow"
bind:value={exportPath}
readonly
/>
<button class="btn btn-info" on:click={onSelectPath}>Pfad auswählen</button>
<button class="btn btn-info" on:click={onExport}>Exportieren</button>
</div>

View file

@ -0,0 +1,54 @@
<script>
export let hvMax;
export let lvMax;
export let hvGewichtung;
export let lvGewichtung;
export let onSubmit;
</script>
<form on:change|preventDefault={onSubmit} class="mb-4">
<div class="grid grid-cols-2 md:grid-cols-4 gap-4">
<div class="form-control">
<label class="label" for="hvMax">HV-Max-Punkte</label>
<input
id="hvMax"
class="input input-bordered"
type="number"
step="0.5"
bind:value={hvMax}
required
/>
</div>
<div class="form-control">
<label class="label" for="hvGewichtung">HV-Gewichtung in %</label>
<input
id="hvGewichtung"
class="input input-bordered"
type="number"
bind:value={hvGewichtung}
required
/>
</div>
<div class="form-control">
<label class="label" for="lvMax">LV-Max-Punkte</label>
<input
id="lvMax"
class="input input-bordered"
type="number"
step="0.5"
bind:value={lvMax}
required
/>
</div>
<div class="form-control">
<label class="label" for="lvGewichtung">LV-Gewichtung in %</label>
<input
id="lvGewichtung"
class="input input-bordered"
type="number"
bind:value={lvGewichtung}
required
/>
</div>
</div>
</form>

View file

@ -0,0 +1,23 @@
<script>
export let notenspiegel;
</script>
<h3 class="text-2xl font-bold mt-8 mb-4">Notenspiegel</h3>
<div class="overflow-x-auto">
<table class="table w-full">
<thead>
<tr>
{#each [1, 2, 3, 4, 5, 6] as note}
<th>{note}</th>
{/each}
</tr>
</thead>
<tbody>
<tr>
{#each [1, 2, 3, 4, 5, 6] as note}
<td>{notenspiegel[note] || 0}</td>
{/each}
</tr>
</tbody>
</table>
</div>

View file

@ -0,0 +1,48 @@
<!-- <script> -->
<!-- import { onMount } from "svelte"; -->
<!---->
<!-- let currentTheme = "macchiato"; -->
<!---->
<!-- function toggleTheme() { -->
<!-- currentTheme = currentTheme === "macchiato" ? "latte" : "macchiato"; -->
<!-- document.getElementById("app").setAttribute("data-theme", currentTheme); -->
<!-- } -->
<!---->
<!-- onMount(() => { -->
<!-- currentTheme = document.getElementById("app").getAttribute("data-theme"); -->
<!-- }); -->
<!-- </script> -->
<!---->
<!-- <button on:click={toggleTheme} class="btn btn-primary"> -->
<!-- Switch to {currentTheme === "macchiato" ? "Latte" : "Macchiato"} -->
<!-- </button> -->
<!---->
<script>
import { onMount } from "svelte";
let currentTheme;
function toggleTheme() {
currentTheme = currentTheme === "macchiato" ? "latte" : "macchiato";
document.getElementById("app").setAttribute("data-theme", currentTheme);
localStorage.setItem("theme", currentTheme);
}
onMount(() => {
currentTheme = localStorage.getItem("theme") || "macchiato";
document.getElementById("app").setAttribute("data-theme", currentTheme);
});
$: isChecked = currentTheme === "macchiato";
</script>
<label class="swap swap-rotate">
<input
type="checkbox"
class="toggle theme-controller"
bind:checked={isChecked}
on:change={toggleTheme}
/>
<span class="swap-on">🌞</span>
<span class="swap-off">🌙</span>
</label>

42
go.mod
View file

@ -1,42 +1,42 @@
module Noten
go 1.21
go 1.22.0
toolchain go1.23.3
toolchain go1.24.4
require (
github.com/jung-kurt/gofpdf v1.16.2
github.com/wailsapp/wails/v2 v2.9.2
github.com/mattn/go-sqlite3 v1.14.24
github.com/wailsapp/wails/v2 v2.10.1
)
require (
github.com/bep/debounce v1.2.1 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e // indirect
github.com/labstack/echo/v4 v4.10.2 // indirect
github.com/labstack/gommon v0.4.0 // indirect
github.com/leaanthony/go-ansi-parser v1.6.0 // indirect
github.com/leaanthony/gosod v1.0.3 // indirect
github.com/labstack/echo/v4 v4.13.3 // indirect
github.com/labstack/gommon v0.4.2 // indirect
github.com/leaanthony/go-ansi-parser v1.6.1 // indirect
github.com/leaanthony/gosod v1.0.4 // indirect
github.com/leaanthony/slicer v1.6.0 // indirect
github.com/leaanthony/u v1.1.0 // indirect
github.com/leaanthony/u v1.1.1 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/samber/lo v1.38.1 // indirect
github.com/tkrajina/go-reflector v0.5.6 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/samber/lo v1.49.1 // indirect
github.com/tkrajina/go-reflector v0.5.8 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect
github.com/wailsapp/go-webview2 v1.0.16 // indirect
github.com/wailsapp/go-webview2 v1.0.19 // indirect
github.com/wailsapp/mimetype v1.4.1 // indirect
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/crypto v0.33.0 // indirect
golang.org/x/net v0.35.0 // indirect
golang.org/x/sys v0.30.0 // indirect
golang.org/x/text v0.22.0 // indirect
)
// replace github.com/wailsapp/wails/v2 v2.9.2 => /home/pata/go/pkg/mod

98
go.sum
View file

@ -4,101 +4,89 @@ github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e h1:Q3+PugElBCf4PFpxhErSzU3/PY5sFL5Z6rfv4AbGAck=
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e/go.mod h1:alcuEEnZsY1WQsagKhZDsoPCRoOijYqhZvPwLG0kzVs=
github.com/jung-kurt/gofpdf v1.0.0/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes=
github.com/jung-kurt/gofpdf v1.16.2 h1:jgbatWHfRlPYiK85qgevsZTHviWXKwB1TTiKdz5PtRc=
github.com/jung-kurt/gofpdf v1.16.2/go.mod h1:1hl7y57EsiPAkLbOwzpzqgx1A30nQCk/YmFV8S2vmK0=
github.com/labstack/echo/v4 v4.10.2 h1:n1jAhnq/elIFTHr1EYpiYtyKgx4RW9ccVgkqByZaN2M=
github.com/labstack/echo/v4 v4.10.2/go.mod h1:OEyqf2//K1DFdE57vw2DRgWY0M7s65IVQO2FzvI4J5k=
github.com/labstack/gommon v0.4.0 h1:y7cvthEAEbU0yHOf4axH8ZG2NH8knB9iNSoTO8dyIk8=
github.com/labstack/gommon v0.4.0/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM=
github.com/labstack/echo/v4 v4.13.3 h1:pwhpCPrTl5qry5HRdM5FwdXnhXSLSY+WE+YQSeCaafY=
github.com/labstack/echo/v4 v4.13.3/go.mod h1:o90YNEeQWjDozo584l7AwhJMHN0bOC4tAfg+Xox9q5g=
github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0=
github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU=
github.com/leaanthony/debme v1.2.1 h1:9Tgwf+kjcrbMQ4WnPcEIUcQuIZYqdWftzZkBr+i/oOc=
github.com/leaanthony/debme v1.2.1/go.mod h1:3V+sCm5tYAgQymvSOfYQ5Xx2JCr+OXiD9Jkw3otUjiA=
github.com/leaanthony/go-ansi-parser v1.6.0 h1:T8TuMhFB6TUMIUm0oRrSbgJudTFw9csT3ZK09w0t4Pg=
github.com/leaanthony/go-ansi-parser v1.6.0/go.mod h1:+vva/2y4alzVmmIEpk9QDhA7vLC5zKDTRwfZGOp3IWU=
github.com/leaanthony/gosod v1.0.3 h1:Fnt+/B6NjQOVuCWOKYRREZnjGyvg+mEhd1nkkA04aTQ=
github.com/leaanthony/gosod v1.0.3/go.mod h1:BJ2J+oHsQIyIQpnLPjnqFGTMnOZXDbvWtRCSG7jGxs4=
github.com/leaanthony/slicer v1.5.0/go.mod h1:FwrApmf8gOrpzEWM2J/9Lh79tyq8KTX5AzRtwV7m4AY=
github.com/leaanthony/go-ansi-parser v1.6.1 h1:xd8bzARK3dErqkPFtoF9F3/HgN8UQk0ed1YDKpEz01A=
github.com/leaanthony/go-ansi-parser v1.6.1/go.mod h1:+vva/2y4alzVmmIEpk9QDhA7vLC5zKDTRwfZGOp3IWU=
github.com/leaanthony/gosod v1.0.4 h1:YLAbVyd591MRffDgxUOU1NwLhT9T1/YiwjKZpkNFeaI=
github.com/leaanthony/gosod v1.0.4/go.mod h1:GKuIL0zzPj3O1SdWQOdgURSuhkF+Urizzxh26t9f1cw=
github.com/leaanthony/slicer v1.6.0 h1:1RFP5uiPJvT93TAHi+ipd3NACobkW53yUiBqZheE/Js=
github.com/leaanthony/slicer v1.6.0/go.mod h1:o/Iz29g7LN0GqH3aMjWAe90381nyZlDNquK+mtH2Fj8=
github.com/leaanthony/u v1.1.0 h1:2n0d2BwPVXSUq5yhe8lJPHdxevE2qK5G99PMStMZMaI=
github.com/leaanthony/u v1.1.0/go.mod h1:9+o6hejoRljvZ3BzdYlVL0JYCwtnAsVuN9pVTQcaRfI=
github.com/matryer/is v1.4.0 h1:sosSmIWwkYITGrxZ25ULNDeKiMNzFSr4V/eqBQP0PeE=
github.com/leaanthony/u v1.1.1 h1:TUFjwDGlNX+WuwVEzDqQwC2lOv0P4uhTQw7CMFdiK7M=
github.com/leaanthony/u v1.1.1/go.mod h1:9+o6hejoRljvZ3BzdYlVL0JYCwtnAsVuN9pVTQcaRfI=
github.com/matryer/is v1.4.0/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU=
github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4=
github.com/matryer/is v1.4.1 h1:55ehd8zaGABKLXQUe2awZ99BD/PTc2ls+KV/dXphgEQ=
github.com/matryer/is v1.4.1/go.mod h1:8I/i5uYgLzgsgEloJE1U6xx5HkBQpAZvepWuujKwMRU=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-sqlite3 v1.14.24 h1:tpSp2G2KyMnnQu99ngJ47EIkWVmliIizyZBfPrBWDRM=
github.com/mattn/go-sqlite3 v1.14.24/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
github.com/phpdave11/gofpdi v1.0.7/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI=
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU=
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI=
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c h1:+mdjkGKdHQG3305AYmdv1U2eRNDiU2ErMBj1gwrq8eQ=
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c/go.mod h1:7rwL4CYBLnjLxUqIJNnCWiEdr3bn6IUYi15bNlnbCCU=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.4 h1:8TfxU8dW6PdqD27gjM8MVNuicgxIjxpm4K7x4jp8sis=
github.com/rivo/uniseg v0.4.4/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w=
github.com/samber/lo v1.38.1 h1:j2XEAqXKb09Am4ebOg31SpvzUTTs6EN3VfgeLUhPdXM=
github.com/samber/lo v1.38.1/go.mod h1:+m/ZKRl6ClXCE2Lgf3MsQlWfh4bn1bz6CXEOxnEXnEA=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/samber/lo v1.49.1 h1:4BIFyVfuQSEpluc7Fua+j1NolZHiEHEpaSEKdsH0tew=
github.com/samber/lo v1.49.1/go.mod h1:dO6KHFzUKXgP8LDhU0oI8d2hekjXnGOu0DB8Jecxd6o=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/tkrajina/go-reflector v0.5.6 h1:hKQ0gyocG7vgMD2M3dRlYN6WBBOmdoOzJ6njQSepKdE=
github.com/tkrajina/go-reflector v0.5.6/go.mod h1:ECbqLgccecY5kPmPmXg1MrHW585yMcDkVl6IvJe64T4=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/tkrajina/go-reflector v0.5.8 h1:yPADHrwmUbMq4RGEyaOUpz2H90sRsETNVpjzo3DLVQQ=
github.com/tkrajina/go-reflector v0.5.8/go.mod h1:ECbqLgccecY5kPmPmXg1MrHW585yMcDkVl6IvJe64T4=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
github.com/wailsapp/go-webview2 v1.0.16 h1:wffnvnkkLvhRex/aOrA3R7FP7rkvOqL/bir1br7BekU=
github.com/wailsapp/go-webview2 v1.0.16/go.mod h1:Uk2BePfCRzttBBjFrBmqKGJd41P6QIHeV9kTgIeOZNo=
github.com/wailsapp/go-webview2 v1.0.19 h1:7U3QcDj1PrBPaxJNCui2k1SkWml+Q5kvFUFyTImA6NU=
github.com/wailsapp/go-webview2 v1.0.19/go.mod h1:qJmWAmAmaniuKGZPWwne+uor3AHMB5PFhqiK0Bbj8kc=
github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs=
github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o=
github.com/wailsapp/wails/v2 v2.9.2 h1:Xb5YRTos1w5N7DTMyYegWaGukCP2fIaX9WF21kPPF2k=
github.com/wailsapp/wails/v2 v2.9.2/go.mod h1:uehvlCwJSFcBq7rMCGfk4rxca67QQGsbg5Nm4m9UnBs=
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 h1:k/i9J1pBpvlfR+9QsetwPyERsqu1GIbi967PQMq3Ivc=
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
github.com/wailsapp/wails/v2 v2.10.1 h1:QWHvWMXII2nI/nXz77gpPG8P3ehl6zKe+u4su5BWIns=
github.com/wailsapp/wails/v2 v2.10.1/go.mod h1:zrebnFV6MQf9kx8HI4iAv63vsR5v67oS7GTEZ7Pz1TY=
golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus=
golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M=
golang.org/x/image v0.0.0-20190910094157-69e4b8554b2a/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8=
golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk=
golang.org/x/sys v0.0.0-20200810151505-1b9f1253b3ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

265
main.go
View file

@ -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,
Bind: []interface{}{
Logger: nil,
LogLevel: logger.DEBUG,
LogLevelProduction: logger.ERROR,
BackgroundColour: &options.RGBA{R: 27, G: 38, B: 54, A: 1},
OnStartup: app.startup,
Bind: []any{
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)

23
models.go Normal file
View file

@ -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"`
}

171
package-lock.json generated Normal file
View file

@ -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"
}
}
}
}

5
package.json Normal file
View file

@ -0,0 +1,5 @@
{
"devDependencies": {
"daisyui": "^4.12.14"
}
}

23
utils.go Normal file
View file

@ -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
}