Compare commits
12 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a0eac4ae95 | |||
| 22e9377062 | |||
| 11e6aab8fd | |||
| 13f313d4a0 | |||
| 64951c579f | |||
| 4130c36335 | |||
| 7f2fc99d0b | |||
| eb640ff749 | |||
| 54a564df04 | |||
| 71dc63f2a2 | |||
| 68f673c8d7 | |||
| d5b7fd7af3 |
@@ -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">
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
Plattformunabhängiger (Windows, Linux, Mac), interaktiver Sportkursplaner für Oberstufen auf Basis einer Sportkurswahl durch SuS.
|
||||
|
||||

|
||||
|
||||
## 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`
|
||||
|
||||
|
||||

|
||||
+717
-368
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 |
@@ -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;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 67 KiB |
+1
-1
@@ -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()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user