12 Commits

9 changed files with 781 additions and 369 deletions
+1
View File
@@ -12,6 +12,7 @@
<!-- <MenuItem Click="MnuSettings_OnClick" x:Name="MnuSettings" Header="Einstellungen" /> -->
<!-- <Separator /> -->
<MenuItem x:Name="MnuExpSettings" Header="Einstellungen exportieren" Click="MnuExpSettings_OnClick" />
<MenuItem x:Name="MnuImpResult" Header="Berechnung importieren" Click="MnuImpResult_OnClick" />
<MenuItem x:Name="MnuExit" Header="Beenden" Click="MnuExit_OnClick"/>
</MenuItem>
<MenuItem Header="Hilfe">
+17
View File
@@ -442,4 +442,21 @@ public partial class MainWindow : Window
ExportUtility.ExportToCSV(file.Path.AbsolutePath);
}
private async void MnuImpResult_OnClick(object? sender, RoutedEventArgs e)
{
// Hier importieren
var topLevel = GetTopLevel(this);
var file = await topLevel!.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
{
Title = "CSV-Datei laden",
SuggestedFileType = new FilePickerFileType(".csv-Datei")
{
Patterns = new[] { "*.csv" }
}
});
if (file == null) return;
}
}
+4
View File
@@ -2,6 +2,8 @@
Plattformunabhängiger (Windows, Linux, Mac), interaktiver Sportkursplaner für Oberstufen auf Basis einer Sportkurswahl durch SuS.
![spplus-Hauptbildschirm](img/spplus_planung.png)
## Features
* \+ Import von CSV-Dateien mit Kurswahl
* \+ Wahlansicht
@@ -21,3 +23,5 @@ Plattformunabhängiger (Windows, Linux, Mac), interaktiver Sportkursplaner für
* Suche `spplus` bzw. `spplus.exe` und führe aus
* Linux/MacOS evl.: `chmod +x spplus`
![spplus-Sportkursübersicht](img/spplus_sport.png)
+717 -368
View File
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

+41
View File
@@ -47,4 +47,45 @@ public static class import
return result;
}
public static List<Student> ImportResultFromFile(string path)
{
var dict = new Dictionary<string, (string Name, List<string> Courses)>();
foreach (var line in File.ReadLines(path).Skip(1)) // Header überspringen
{
if (string.IsNullOrWhiteSpace(line))
continue;
var parts = line.Split(',');
if (parts.Length < 3)
continue;
string nameWithId = parts[0].Trim();
string course = parts[2].Replace("(2)", "").Replace("(3)", "").Replace("(4)", "").Trim();
int open = nameWithId.LastIndexOf('(');
int close = nameWithId.LastIndexOf(')');
if (open < 0 || close < 0 || close <= open)
continue;
string name = nameWithId[..open].Trim();
string id = nameWithId[(open + 1)..close].Trim();
if (!dict.ContainsKey(id))
dict[id] = (name, new List<string>());
dict[id].Courses.Add(course);
}
var result = new List<Student>();
foreach (var (id, data) in dict)
{
var student = new Student(id, data.Name, data.Courses);
result.Add(student);
}
return result;
}
}
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 67 KiB

+1 -1
View File
@@ -85,7 +85,7 @@ public class Settings
public List<Student> Students { get; set; } = [];
public List<Sport> Sports { get; set; } = [];
public int NumCoursesPerSemester { get; set; } = 10;
public int NumCoursesPerSemester { get; set; } = 10; // Exact Amount of courses, not a maximum
public Settings()
{