Compare commits
14 Commits
987f27fcbc
...
spplus1.2.
| Author | SHA1 | Date | |
|---|---|---|---|
| a1bf573a07 | |||
| 525f3fb4ae | |||
| 9f298d8ce8 | |||
| 11d9c641a6 | |||
| c2f7adc1d0 | |||
| c19f96ea37 | |||
| 9bbde62d70 | |||
| a83f97828c | |||
| 44654dd784 | |||
| 410055c9f2 | |||
| ce75d8aa0b | |||
| be436f1b1c | |||
| 14c11b81b6 | |||
| dd38b91d68 |
@@ -4,7 +4,7 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="spplus.MainWindow" WindowState="Maximized"
|
||||
Title="SP+">
|
||||
Title="spplus">
|
||||
<Border>
|
||||
<Grid RowDefinitions="30,*">
|
||||
<Menu Background="#50888888">
|
||||
@@ -20,7 +20,7 @@
|
||||
<MenuItem Header="Über" x:Name="MnuAbout" Click="MnuAbout_OnClick" />
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
<TabControl x:Name="TclMainView" Grid.Row="1">
|
||||
<TabControl x:Name="TclMainView" Grid.Row="1" TabStripPlacement="Left">
|
||||
<TabItem>
|
||||
<TabItem.Header>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
@@ -88,6 +88,11 @@
|
||||
<Label Content="Anzahl gewählte Kurse"></Label>
|
||||
<Label Grid.Column="1" x:Name="LblSelectedAmount"></Label>
|
||||
</Grid>
|
||||
|
||||
<Grid ColumnDefinitions="*,3*">
|
||||
<Label Content="Wahlzahlen"></Label>
|
||||
<Label Grid.Column="1" x:Name="LblNumVoted"></Label>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
|
||||
|
||||
@@ -205,14 +210,23 @@
|
||||
</StackPanel>
|
||||
</TabItem.Header>
|
||||
<Grid ColumnDefinitions="*,*" RowDefinitions="50,2*,*">
|
||||
<ListBox Grid.RowSpan="2" x:Name="LbResult" Margin="10,10,10,10"></ListBox>
|
||||
<Button Grid.Row="0" Grid.Column="1" Margin="0,10,0,0" x:Name="BtnExportCoursePDF" VerticalAlignment="Top" Height="35" HorizontalAlignment="Stretch" Click="BtnExportCoursePDF_OnClick" HorizontalContentAlignment="Center">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<LucideIcon Kind="FileText" Width="24" Height="24" />
|
||||
<Label Content="Export (PDF)..." VerticalContentAlignment="Center" FontSize="12"
|
||||
FontWeight="Bold" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<ListBox Grid.RowSpan="2" x:Name="LbResult" Margin="0,10,10,10"></ListBox>
|
||||
<Grid Grid.Row="0" Grid.Column="1" Grid.ColumnDefinitions="*,*">
|
||||
<Button Grid.Column="0" Margin="0,10,0,0" x:Name="BtnExportCoursePDF" VerticalAlignment="Top" Height="35" HorizontalAlignment="Stretch" Click="BtnExportCoursePDF_OnClick" HorizontalContentAlignment="Center">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<LucideIcon Kind="FileText" Width="24" Height="24" />
|
||||
<Label Content="Export (PDF)..." VerticalContentAlignment="Center" FontSize="12"
|
||||
FontWeight="Bold" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
<Button Grid.Column="1" Margin="5,10,0,0" x:Name="BtnExportCourseCSV" VerticalAlignment="Top" Height="35" HorizontalAlignment="Stretch" Click="BtnExportCourseCSV_OnClick" HorizontalContentAlignment="Center">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<LucideIcon Kind="FileJson" Width="24" Height="24" />
|
||||
<Label Content="Export (CSV)..." VerticalContentAlignment="Center" FontSize="12"
|
||||
FontWeight="Bold" />
|
||||
</StackPanel>
|
||||
</Button>
|
||||
</Grid>
|
||||
<ScrollViewer Grid.Row="1" Grid.Column="1" Margin="0,5,0,10" Background="#44CCCCCC">
|
||||
<TextBlock x:Name="TbResultStatistics"></TextBlock>
|
||||
</ScrollViewer>
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace spplus;
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public static MainWindow Instance { get; set; }
|
||||
public static string ApplicationVersion = "v1.2.24";
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -40,7 +41,7 @@ public partial class MainWindow : Window
|
||||
Process.Start(new ProcessStartInfo
|
||||
{
|
||||
FileName = "https://git.mypapercloud.de/fierke/spplus/wiki",
|
||||
UseShellExecute = true // Wichtig für Plattformübergreifendes Öffnen
|
||||
UseShellExecute = true
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -56,7 +57,7 @@ public partial class MainWindow : Window
|
||||
Process.Start(new ProcessStartInfo
|
||||
{
|
||||
FileName = "https://git.mypapercloud.de/fierke/spplus",
|
||||
UseShellExecute = true // Wichtig für Plattformübergreifendes Öffnen
|
||||
UseShellExecute = true
|
||||
});
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -75,7 +76,7 @@ public partial class MainWindow : Window
|
||||
Grid g = new();
|
||||
TextBlock tb = new()
|
||||
{
|
||||
Text = "spplus v1.0.0\n(c)2026 MyPapertown, Elias Fierke"
|
||||
Text = $"spplus {MainWindow.ApplicationVersion}\n(c)2026 MyPapertown, Elias Fierke"
|
||||
};
|
||||
g.Children.Add(tb);
|
||||
w.Content = g;
|
||||
@@ -122,14 +123,40 @@ public partial class MainWindow : Window
|
||||
LblStudentAmount.Content = Settings.Instance.Students.Count.ToString();
|
||||
LblSelectedAmount.Content = count_selected.ToString();
|
||||
|
||||
List<(Sport, List<string>)> initial_sportlist = new();
|
||||
foreach (var sp in Settings.Instance.Sports)
|
||||
{
|
||||
initial_sportlist.Add((sp, new()));
|
||||
}
|
||||
foreach (Student s in Settings.Instance.Students)
|
||||
{
|
||||
foreach (var sp in s.SelectedCourseNames)
|
||||
{
|
||||
foreach (var item in initial_sportlist)
|
||||
{
|
||||
if (item.Item1.AlternativeNames.Contains(sp))
|
||||
{
|
||||
item.Item2.Add(s.ID);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LblNumVoted.Content = "";
|
||||
foreach (var s in initial_sportlist)
|
||||
{
|
||||
LblNumVoted.Content += $"{s.Item1.Name}: {s.Item2.Count}\n";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void BtnCraftCourses_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
// Craft courses here / call course-crafter
|
||||
CourseCrafter.Craft();
|
||||
RefreshResultView();
|
||||
TbiResults.Focus();
|
||||
TclMainView.SelectedIndex = 2;
|
||||
//TbiResults.Focus();
|
||||
}
|
||||
|
||||
private void RefreshResultView()
|
||||
@@ -139,7 +166,7 @@ public partial class MainWindow : Window
|
||||
{
|
||||
try
|
||||
{
|
||||
for(int i = 0; i<s.Result.Count;i++)
|
||||
for(int i = 0; i<s.Result.Length;i++)
|
||||
{
|
||||
LbResult.Items.Add($"{s.Name} ({s.ID}) - {i+1}. Semester: {s.Result[i]}");
|
||||
}
|
||||
@@ -396,4 +423,23 @@ public partial class MainWindow : Window
|
||||
Settings.Instance.NumCoursesPerSemester = Convert.ToInt32(NudSportMaxPerSemester.Value);
|
||||
} catch {}
|
||||
}
|
||||
|
||||
private async void BtnExportCourseCSV_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
var topLevel = GetTopLevel(this);
|
||||
var file = await topLevel!.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
|
||||
{
|
||||
Title = "CSV-Datei speichern",
|
||||
SuggestedFileType = new FilePickerFileType(".csv-Datei")
|
||||
{
|
||||
Patterns = new[] { "*.csv" }
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
if (file == null) return;
|
||||
|
||||
ExportUtility.ExportToCSV(file.Path.AbsolutePath);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,15 @@
|
||||
# SP+
|
||||
|
||||
Interaktiver Sportkursplaner für Oberstufen auf Basis einer Sportkurswahl durch SuS.
|
||||
Plattformunabhängiger (Windows, Linux, Mac), interaktiver Sportkursplaner für Oberstufen auf Basis einer Sportkurswahl durch SuS.
|
||||
|
||||
## Features
|
||||
* \+ Import von CSV-Dateien mit Kurswahl
|
||||
* \+ Wahlansicht
|
||||
* \+ Statistiken
|
||||
* \+ Pflege von Sportkursen (inkl. Kürzel/ alternativen Bezeichnungen)
|
||||
* \+ CSV-Export
|
||||
* ~ Fehleransicht für nicht-existente, aber gewählte Kurse
|
||||
* ~ PDF-Export
|
||||
|
||||
\+ Vorhanden, ~ Pending
|
||||
|
||||
|
||||
74
crafter.cs
74
crafter.cs
@@ -314,7 +314,7 @@ public class CourseCrafter
|
||||
|
||||
if (errors.Count == 0)
|
||||
{
|
||||
MainWindow.Instance.TbResultLog.Text = "Alles generierten Kursen erfüllen die gegebenen Voraussetzungen.";
|
||||
MainWindow.Instance.TbResultLog.Text = "--- Alle generierten Kursen erfüllen die gegebenen Voraussetzungen ---";
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -323,6 +323,17 @@ public class CourseCrafter
|
||||
MainWindow.Instance.TbResultLog.Text += e + "\n";
|
||||
}
|
||||
|
||||
foreach (var course in GeneratedCourses)
|
||||
{
|
||||
foreach (var student in Settings.Instance.Students)
|
||||
{
|
||||
if (course.Instance.Students.Contains(student.ID))
|
||||
{
|
||||
student.Result[course.Semester-1] = course.Instance.Sport.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static string GenerateStatistics()
|
||||
@@ -339,67 +350,6 @@ public class CourseCrafter
|
||||
return sb;
|
||||
}
|
||||
|
||||
public static string GenerateStatisticsOld()
|
||||
{
|
||||
var settings = Settings.Instance;
|
||||
var students = settings.Students;
|
||||
|
||||
if (GeneratedCourses == null || GeneratedCourses.Count == 0)
|
||||
return "Keine Kurse generiert.";
|
||||
|
||||
int semesterCount = students
|
||||
.Where(s => s.Result != null)
|
||||
.Select(s => s.Result!.Count)
|
||||
.DefaultIfEmpty(0)
|
||||
.Max();
|
||||
|
||||
var sb = new System.Text.StringBuilder();
|
||||
|
||||
sb.AppendLine($"Anzahl generierter Kurse: {GeneratedCourses.Count}");
|
||||
sb.AppendLine("Übersicht:");
|
||||
|
||||
// ===== Kursübersicht =====
|
||||
var grouped = GeneratedCourses
|
||||
.GroupBy(g => new { g.Semester, g.Instance.Sport.Name })
|
||||
.OrderBy(g => g.Key.Semester)
|
||||
.ThenBy(g => g.Key.Name);
|
||||
|
||||
foreach (var group in grouped)
|
||||
{
|
||||
int counter = 1;
|
||||
|
||||
foreach (var entry in group)
|
||||
{
|
||||
int semester = group.Key.Semester + 1;
|
||||
string sportName = group.Key.Name;
|
||||
string number = counter.ToString("D2");
|
||||
int count = entry.Instance.Students.Count;
|
||||
|
||||
sb.AppendLine(
|
||||
$"Semester {semester}: {sportName} {number}: {count} Schüler*innen"
|
||||
);
|
||||
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
|
||||
sb.AppendLine();
|
||||
sb.AppendLine("Fehlerübersicht:");
|
||||
|
||||
// ===== Fehler pro Semester =====
|
||||
for (int sem = 0; sem < semesterCount; sem++)
|
||||
{
|
||||
int errors = students.Count(st =>
|
||||
st.Result != null &&
|
||||
st.Result.Count > sem &&
|
||||
st.Result[sem] == "Fehler");
|
||||
|
||||
sb.AppendLine($"Semester {sem + 1}: {errors} Fehler");
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public static List<string> ValidateCourses(List<(int Semester, CourseInstance Instance)> courses)
|
||||
{
|
||||
List<string> errors = new();
|
||||
|
||||
19
exporter.cs
Normal file
19
exporter.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System.IO;
|
||||
|
||||
namespace spplus;
|
||||
|
||||
public static class ExportUtility
|
||||
{
|
||||
public static void ExportToCSV(string filepath)
|
||||
{
|
||||
char separator = ',';
|
||||
string header = $"SchuelerID{separator}Sem1{separator}Sem2{separator}Sem3{separator}Sem4";
|
||||
string output = header + "\n";
|
||||
foreach (var student in Settings.Instance.Students)
|
||||
{
|
||||
output += $"{student.ID}{separator}{student.Result[0]}{separator}{student.Result[1]}{separator}{student.Result[2]}{separator}{student.Result[3]}\n";
|
||||
}
|
||||
|
||||
File.WriteAllText(filepath, output);
|
||||
}
|
||||
}
|
||||
@@ -59,7 +59,7 @@ public class Student
|
||||
public string ID { get; set; } = ""; // ID des Schüler (z.B. NolteSeb)
|
||||
public string Name { get; set; } = ""; // Name des Schülers
|
||||
public List<string> SelectedCourseNames { get; set; } = new();
|
||||
public List<string>? Result { get; set; } = null;
|
||||
public string[] Result { get; set; } = new string[4];
|
||||
|
||||
public Student()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user