Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 66596b530b | |||
| 5ef41b21b0 | |||
| c291ed1788 | |||
| 78d25e6231 | |||
| 73af2039ba | |||
| c5be9d2c6e | |||
| c46417c56d | |||
| 895c55a52f | |||
| e54e2e7840 | |||
| 0a710bea8b | |||
| d4de543d71 |
+40
-8
@@ -3,7 +3,7 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||||
x:Class="spplus.MainWindow" WindowState="Maximized"
|
x:Class="spplus.MainWindow" WindowState="Maximized" Icon="res/logo.ico"
|
||||||
Title="spplus">
|
Title="spplus">
|
||||||
<Border>
|
<Border>
|
||||||
<Grid RowDefinitions="30,*">
|
<Grid RowDefinitions="30,*">
|
||||||
@@ -196,8 +196,20 @@
|
|||||||
</Grid>
|
</Grid>
|
||||||
<Line />
|
<Line />
|
||||||
<Grid ColumnDefinitions="*,3*">
|
<Grid ColumnDefinitions="*,3*">
|
||||||
<Label Content="Maximale Sportkursanzahl pro Semester"></Label>
|
<Label Content="Maximale Sportkursanzahl Semester 1"></Label>
|
||||||
<NumericUpDown Grid.Column="1" x:Name="NudSportMaxPerSemester" ValueChanged="NudSportMaxPerSemester_OnValueChanged"></NumericUpDown>
|
<NumericUpDown Grid.Column="1" x:Name="NudSportMaxPerSemester1" ValueChanged="NudSportMaxPerSemester1_OnValueChanged"></NumericUpDown>
|
||||||
|
</Grid>
|
||||||
|
<Grid ColumnDefinitions="*,3*">
|
||||||
|
<Label Content="Maximale Sportkursanzahl Semester 2"></Label>
|
||||||
|
<NumericUpDown Grid.Column="1" x:Name="NudSportMaxPerSemester2" ValueChanged="NudSportMaxPerSemester2_OnValueChanged"></NumericUpDown>
|
||||||
|
</Grid>
|
||||||
|
<Grid ColumnDefinitions="*,3*">
|
||||||
|
<Label Content="Maximale Sportkursanzahl Semester 3"></Label>
|
||||||
|
<NumericUpDown Grid.Column="1" x:Name="NudSportMaxPerSemester3" ValueChanged="NudSportMaxPerSemester3_OnValueChanged"></NumericUpDown>
|
||||||
|
</Grid>
|
||||||
|
<Grid ColumnDefinitions="*,3*">
|
||||||
|
<Label Content="Maximale Sportkursanzahl Semester 4"></Label>
|
||||||
|
<NumericUpDown Grid.Column="1" x:Name="NudSportMaxPerSemester4" ValueChanged="NudSportMaxPerSemester4_OnValueChanged"></NumericUpDown>
|
||||||
</Grid>
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -210,23 +222,43 @@
|
|||||||
<Label FontSize="20" Content="Ergebnisse" VerticalContentAlignment="Center" />
|
<Label FontSize="20" Content="Ergebnisse" VerticalContentAlignment="Center" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</TabItem.Header>
|
</TabItem.Header>
|
||||||
<Grid ColumnDefinitions="*,*" RowDefinitions="50,2*,*">
|
<Grid ColumnDefinitions="*,*" RowDefinitions="100,2*,*">
|
||||||
<ListBox Grid.RowSpan="2" x:Name="LbResult" Margin="0,10,10,10"></ListBox>
|
<ListBox Grid.RowSpan="2" x:Name="LbResult" Margin="0,10,10,10" PointerPressed="LbResult_OnPointerPressed">
|
||||||
<Grid Grid.Row="0" Grid.Column="1" Grid.ColumnDefinitions="*,*">
|
<ListBox.ContextMenu>
|
||||||
<Button Grid.Column="0" Margin="0,10,0,0" x:Name="BtnExportCoursePDF" VerticalAlignment="Top" Height="35" HorizontalAlignment="Stretch" Click="BtnExportCoursePDF_OnClick" HorizontalContentAlignment="Center">
|
<ContextMenu>
|
||||||
|
<MenuItem Header="Ändern" x:Name="MnuChange" />
|
||||||
|
</ContextMenu>
|
||||||
|
</ListBox.ContextMenu>
|
||||||
|
</ListBox>
|
||||||
|
<Grid Grid.Row="0" Grid.Column="1" RowDefinitions="*,*" ColumnDefinitions="*,*">
|
||||||
|
<Button Grid.Row="0" Grid.Column="0" Margin="0,10,5,0" x:Name="BtnExportCoursePDF" VerticalAlignment="Top" Height="35" HorizontalAlignment="Stretch" Click="BtnExportCoursePDF_OnClick" HorizontalContentAlignment="Center">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<LucideIcon Kind="FileText" Width="24" Height="24" />
|
<LucideIcon Kind="FileText" Width="24" Height="24" />
|
||||||
<Label Content="Export (PDF)..." VerticalContentAlignment="Center" FontSize="12"
|
<Label Content="Export (PDF)..." VerticalContentAlignment="Center" FontSize="12"
|
||||||
FontWeight="Bold" />
|
FontWeight="Bold" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
<Button Grid.Column="1" Margin="5,10,0,0" x:Name="BtnExportCourseCSV" VerticalAlignment="Top" Height="35" HorizontalAlignment="Stretch" Click="BtnExportCourseCSV_OnClick" HorizontalContentAlignment="Center">
|
<Button Grid.Row="0" 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">
|
<StackPanel Orientation="Horizontal">
|
||||||
<LucideIcon Kind="FileJson" Width="24" Height="24" />
|
<LucideIcon Kind="FileJson" Width="24" Height="24" />
|
||||||
<Label Content="Export (CSV)..." VerticalContentAlignment="Center" FontSize="12"
|
<Label Content="Export (CSV)..." VerticalContentAlignment="Center" FontSize="12"
|
||||||
FontWeight="Bold" />
|
FontWeight="Bold" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
|
<Button Grid.Row="1" Grid.Column="0" Margin="0,5,5,0" x:Name="BtnExportConfiguration" VerticalAlignment="Top" Height="35" HorizontalAlignment="Stretch" Click="MnuExpSettings_OnClick" HorizontalContentAlignment="Center">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<LucideIcon Kind="FileJson" Width="24" Height="24" />
|
||||||
|
<Label Content="Konfiguration exportieren..." VerticalContentAlignment="Center" FontSize="12"
|
||||||
|
FontWeight="Bold" />
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
|
<Button Grid.Row="1" Grid.Column="1" Margin="5,5,0,0" x:Name="BtnImportResults" VerticalAlignment="Top" Height="35" HorizontalAlignment="Stretch" Click="MnuImpResult_OnClick" HorizontalContentAlignment="Center">
|
||||||
|
<StackPanel Orientation="Horizontal">
|
||||||
|
<LucideIcon Kind="Import" Width="24" Height="24" />
|
||||||
|
<Label Content="Ergebnisse importieren..." VerticalContentAlignment="Center" FontSize="12"
|
||||||
|
FontWeight="Bold" />
|
||||||
|
</StackPanel>
|
||||||
|
</Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
<ScrollViewer Grid.Row="1" Grid.Column="1" Margin="0,5,0,10" Background="#44CCCCCC">
|
<ScrollViewer Grid.Row="1" Grid.Column="1" Margin="0,5,0,10" Background="#44CCCCCC">
|
||||||
<TextBlock x:Name="TbResultStatistics"></TextBlock>
|
<TextBlock x:Name="TbResultStatistics"></TextBlock>
|
||||||
|
|||||||
+220
-15
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Linq;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
using Avalonia.Interactivity;
|
using Avalonia.Interactivity;
|
||||||
@@ -12,6 +13,26 @@ public partial class MainWindow : Window
|
|||||||
{
|
{
|
||||||
public static MainWindow Instance { get; set; }
|
public static MainWindow Instance { get; set; }
|
||||||
public static string ApplicationVersion = "v1.2.24";
|
public static string ApplicationVersion = "v1.2.24";
|
||||||
|
|
||||||
|
private sealed class ResultEntry
|
||||||
|
{
|
||||||
|
public Student Student { get; }
|
||||||
|
public int Semester { get; }
|
||||||
|
public string CourseName { get; }
|
||||||
|
|
||||||
|
public ResultEntry(Student student, int semester, string? courseName)
|
||||||
|
{
|
||||||
|
Student = student;
|
||||||
|
Semester = semester;
|
||||||
|
CourseName = courseName ?? string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return $"{Student.Name} ({Student.ID}) - {Semester}. Semester: {CourseName}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@@ -20,13 +41,111 @@ public partial class MainWindow : Window
|
|||||||
RefreshCoursesList();
|
RefreshCoursesList();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
NudSportMaxPerSemester.Value = Settings.Instance.NumCoursesPerSemester;
|
NudSportMaxPerSemester1.Value = Settings.Instance.NumCoursesPerSemester[0];
|
||||||
|
NudSportMaxPerSemester2.Value = Settings.Instance.NumCoursesPerSemester[1];
|
||||||
|
NudSportMaxPerSemester3.Value = Settings.Instance.NumCoursesPerSemester[2];
|
||||||
|
NudSportMaxPerSemester4.Value = Settings.Instance.NumCoursesPerSemester[3];
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MnuExpSettings_OnClick(object? sender, RoutedEventArgs e)
|
private void RegenerateContextMenu()
|
||||||
{
|
{
|
||||||
var res = MessageBox.Show(this, "Dieses Feature ist noch nicht implementiert", "Fehlend");
|
MnuChange.Items.Clear();
|
||||||
|
foreach (var sport in Settings.Instance.Sports)
|
||||||
|
{
|
||||||
|
var item = new MenuItem { Header = sport.Name };
|
||||||
|
item.Click += (_, _) => ChangeStudentCourse(sport);
|
||||||
|
MnuChange.Items.Add(item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ChangeStudentCourse(Sport targetSport)
|
||||||
|
{
|
||||||
|
if (LbResult.SelectedItem is not ResultEntry selectedEntry)
|
||||||
|
return;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (ApplyStudentCourseChange(selectedEntry.Student, selectedEntry.Semester, targetSport))
|
||||||
|
{
|
||||||
|
CourseCrafter.ReloadResult();
|
||||||
|
RefreshResultView();
|
||||||
|
RegenerateContextMenu();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine(ex.Message + "\n" + ex.StackTrace);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool ApplyStudentCourseChange(Student student, int semester, Sport targetSport)
|
||||||
|
{
|
||||||
|
if (semester < 1 || semester > 4)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
var semesterCourses = CourseCrafter.GeneratedCourses
|
||||||
|
.Where(course => course.Semester == semester)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
var currentCourses = semesterCourses
|
||||||
|
.Where(course => course.Instance.Students.Contains(student.ID))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
CourseCrafter.CourseInstance? targetCourse = currentCourses
|
||||||
|
.FirstOrDefault(course => course.Instance.Sport.Name == targetSport.Name)
|
||||||
|
.Instance;
|
||||||
|
|
||||||
|
if (targetCourse == null)
|
||||||
|
{
|
||||||
|
targetCourse = semesterCourses
|
||||||
|
.Where(course => course.Instance.Sport.Name == targetSport.Name)
|
||||||
|
.OrderBy(course => course.Instance.Students.Count)
|
||||||
|
.Select(course => course.Instance)
|
||||||
|
.FirstOrDefault();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool changed = false;
|
||||||
|
|
||||||
|
foreach (var course in currentCourses)
|
||||||
|
{
|
||||||
|
if (targetCourse != null && ReferenceEquals(course.Instance, targetCourse))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (course.Instance.Students.Remove(student.ID))
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int removedEmptyCourses = CourseCrafter.GeneratedCourses.RemoveAll(course =>
|
||||||
|
course.Semester == semester &&
|
||||||
|
course.Instance.Students.Count == 0 &&
|
||||||
|
!ReferenceEquals(course.Instance, targetCourse));
|
||||||
|
if (removedEmptyCourses > 0)
|
||||||
|
changed = true;
|
||||||
|
|
||||||
|
if (targetCourse == null)
|
||||||
|
{
|
||||||
|
var newCourse = new CourseCrafter.CourseInstance
|
||||||
|
{
|
||||||
|
Sport = targetSport,
|
||||||
|
Students = new List<string> { student.ID }
|
||||||
|
};
|
||||||
|
|
||||||
|
CourseCrafter.GeneratedCourses.Add((semester, newCourse));
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
else if (!targetCourse.Students.Contains(student.ID))
|
||||||
|
{
|
||||||
|
targetCourse.Students.Add(student.ID);
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return changed;
|
||||||
|
}
|
||||||
|
|
||||||
|
private async void MnuExpSettings_OnClick(object? sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
await ExportConfigurationAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MnuExit_OnClick(object? sender, RoutedEventArgs e)
|
private void MnuExit_OnClick(object? sender, RoutedEventArgs e)
|
||||||
@@ -159,6 +278,21 @@ public partial class MainWindow : Window
|
|||||||
//TbiResults.Focus();
|
//TbiResults.Focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void LbResult_OnPointerPressed(object? sender, PointerPressedEventArgs e)
|
||||||
|
{
|
||||||
|
if (!e.GetCurrentPoint(LbResult).Properties.IsRightButtonPressed)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (e.Source is Control control && control.DataContext is ResultEntry entry)
|
||||||
|
{
|
||||||
|
LbResult.SelectedItem = entry;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LbResult.SelectedItem = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void RefreshResultView()
|
private void RefreshResultView()
|
||||||
{
|
{
|
||||||
LbResult.Items.Clear();
|
LbResult.Items.Clear();
|
||||||
@@ -168,7 +302,7 @@ public partial class MainWindow : Window
|
|||||||
{
|
{
|
||||||
for(int i = 0; i<s.Result.Length;i++)
|
for(int i = 0; i<s.Result.Length;i++)
|
||||||
{
|
{
|
||||||
LbResult.Items.Add($"{s.Name} ({s.ID}) - {i+1}. Semester: {s.Result[i]}");
|
LbResult.Items.Add(new ResultEntry(s, i + 1, s.Result[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -262,6 +396,7 @@ public partial class MainWindow : Window
|
|||||||
{
|
{
|
||||||
LbSportCourses.Items.Add(sp);
|
LbSportCourses.Items.Add(sp);
|
||||||
}
|
}
|
||||||
|
RegenerateContextMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -298,6 +433,7 @@ public partial class MainWindow : Window
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
((Sport)LbSportCourses.SelectedItem).Name = TbSportName.Text;
|
((Sport)LbSportCourses.SelectedItem).Name = TbSportName.Text;
|
||||||
|
RegenerateContextMenu();
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -411,16 +547,53 @@ public partial class MainWindow : Window
|
|||||||
} catch (Exception ex){}
|
} catch (Exception ex){}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BtnExportCoursePDF_OnClick(object? sender, RoutedEventArgs e)
|
private async void BtnExportCoursePDF_OnClick(object? sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
// Export as PDF
|
var topLevel = GetTopLevel(this);
|
||||||
|
var file = await topLevel!.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
|
||||||
|
{
|
||||||
|
Title = "PDF-Datei speichern",
|
||||||
|
SuggestedFileName = "spplus_kurse.pdf",
|
||||||
|
SuggestedFileType = new FilePickerFileType(".pdf-Datei")
|
||||||
|
{
|
||||||
|
Patterns = new[] { "*.pdf" }
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (file == null) return;
|
||||||
|
|
||||||
|
PdfExportUtility.ExportGeneratedCourses(file.Path.LocalPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void NudSportMaxPerSemester_OnValueChanged(object? sender, NumericUpDownValueChangedEventArgs e)
|
private void NudSportMaxPerSemester1_OnValueChanged(object? sender, NumericUpDownValueChangedEventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Settings.Instance.NumCoursesPerSemester = Convert.ToInt32(NudSportMaxPerSemester.Value);
|
Settings.Instance.NumCoursesPerSemester[0] = Convert.ToInt32(NudSportMaxPerSemester1.Value);
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void NudSportMaxPerSemester2_OnValueChanged(object? sender, NumericUpDownValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Settings.Instance.NumCoursesPerSemester[1] = Convert.ToInt32(NudSportMaxPerSemester2.Value);
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void NudSportMaxPerSemester3_OnValueChanged(object? sender, NumericUpDownValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Settings.Instance.NumCoursesPerSemester[2] = Convert.ToInt32(NudSportMaxPerSemester3.Value);
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void NudSportMaxPerSemester4_OnValueChanged(object? sender, NumericUpDownValueChangedEventArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Settings.Instance.NumCoursesPerSemester[3] = Convert.ToInt32(NudSportMaxPerSemester4.Value);
|
||||||
} catch {}
|
} catch {}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -430,33 +603,65 @@ public partial class MainWindow : Window
|
|||||||
var file = await topLevel!.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
|
var file = await topLevel!.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
|
||||||
{
|
{
|
||||||
Title = "CSV-Datei speichern",
|
Title = "CSV-Datei speichern",
|
||||||
SuggestedFileType = new FilePickerFileType(".csv-Datei")
|
SuggestedFileName = "spplus_ergebnisse.json",
|
||||||
|
SuggestedFileType = new FilePickerFileType(".json-Datei")
|
||||||
{
|
{
|
||||||
Patterns = new[] { "*.csv" }
|
Patterns = new[] { "*.json" }
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (file == null) return;
|
if (file == null) return;
|
||||||
|
|
||||||
ExportUtility.ExportToCSV(file.Path.AbsolutePath);
|
ExportUtility.ExportResultsToJson(file.Path.LocalPath);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void MnuImpResult_OnClick(object? sender, RoutedEventArgs e)
|
private async void MnuImpResult_OnClick(object? sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
// Hier importieren
|
|
||||||
var topLevel = GetTopLevel(this);
|
var topLevel = GetTopLevel(this);
|
||||||
var file = await topLevel!.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
|
var file = await topLevel!.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
|
||||||
{
|
{
|
||||||
Title = "CSV-Datei laden",
|
Title = "Ergebnis-CSV laden",
|
||||||
SuggestedFileType = new FilePickerFileType(".csv-Datei")
|
AllowMultiple = false,
|
||||||
|
FileTypeFilter = new[]
|
||||||
{
|
{
|
||||||
Patterns = new[] { "*.csv" }
|
new FilePickerFileType(".json-Datei")
|
||||||
|
{
|
||||||
|
Patterns = new[] { "*.json" }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (file == null || file.Count == 0) return;
|
||||||
|
|
||||||
|
var imported = import.ImportResultFromJson(file[0].Path.LocalPath.ToString());
|
||||||
|
if (imported != null && imported.Count > 0)
|
||||||
|
{
|
||||||
|
CourseCrafter.GeneratedCourses = imported
|
||||||
|
.OrderBy(c => c.Semester)
|
||||||
|
.ThenBy(c => c.Instance.Sport.Name)
|
||||||
|
.ToList();
|
||||||
|
CourseCrafter.ReloadResult();
|
||||||
|
RefreshResultView();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async System.Threading.Tasks.Task ExportConfigurationAsync()
|
||||||
|
{
|
||||||
|
var topLevel = GetTopLevel(this);
|
||||||
|
var file = await topLevel!.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
|
||||||
|
{
|
||||||
|
Title = "Konfiguration speichern",
|
||||||
|
SuggestedFileName = "spplus_konfiguration.json",
|
||||||
|
SuggestedFileType = new FilePickerFileType(".json-Datei")
|
||||||
|
{
|
||||||
|
Patterns = new[] { "*.json" }
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (file == null) return;
|
if (file == null) return;
|
||||||
|
|
||||||
|
ExportUtility.ExportConfigurationToJson(file.Path.LocalPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+1
-1
@@ -2,7 +2,7 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
mc:Ignorable="d" SizeToContent="WidthAndHeight"
|
mc:Ignorable="d" SizeToContent="WidthAndHeight" Icon="res/logo.ico"
|
||||||
x:Class="spplus.MessageBox" WindowStartupLocation="CenterScreen"
|
x:Class="spplus.MessageBox" WindowStartupLocation="CenterScreen"
|
||||||
Title="MessageBox">
|
Title="MessageBox">
|
||||||
<StackPanel>
|
<StackPanel>
|
||||||
|
|||||||
+9
-1
@@ -1,5 +1,7 @@
|
|||||||
using Avalonia;
|
using Avalonia;
|
||||||
using System;
|
using System;
|
||||||
|
using PdfSharp;
|
||||||
|
using PdfSharp.Fonts;
|
||||||
|
|
||||||
namespace spplus;
|
namespace spplus;
|
||||||
|
|
||||||
@@ -9,8 +11,14 @@ class Program
|
|||||||
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
|
||||||
// yet and stuff might break.
|
// yet and stuff might break.
|
||||||
[STAThread]
|
[STAThread]
|
||||||
public static void Main(string[] args) => BuildAvaloniaApp()
|
public static void Main(string[] args)
|
||||||
|
{
|
||||||
|
// Initialize PdfSharp font resolver before any PDF operations
|
||||||
|
GlobalFontSettings.FontResolver = new CustomFontResolver();
|
||||||
|
|
||||||
|
BuildAvaloniaApp()
|
||||||
.StartWithClassicDesktopLifetime(args);
|
.StartWithClassicDesktopLifetime(args);
|
||||||
|
}
|
||||||
|
|
||||||
// Avalonia configuration, don't remove; also used by visual designer.
|
// Avalonia configuration, don't remove; also used by visual designer.
|
||||||
public static AppBuilder BuildAvaloniaApp()
|
public static AppBuilder BuildAvaloniaApp()
|
||||||
|
|||||||
+72
-50
@@ -15,6 +15,66 @@ public class CourseCrafter
|
|||||||
public static List<(int Semester, CourseInstance Instance)> GeneratedCourses
|
public static List<(int Semester, CourseInstance Instance)> GeneratedCourses
|
||||||
= new();
|
= new();
|
||||||
|
|
||||||
|
private static Sport? ResolveSportFromCourseName(string courseName)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(courseName) ||
|
||||||
|
string.Equals(courseName, "null", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Settings.Instance.Sports.FirstOrDefault(sport =>
|
||||||
|
string.Equals(sport.Name, courseName, StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
sport.AlternativeNames.Any(alt => string.Equals(alt, courseName, StringComparison.OrdinalIgnoreCase)));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void RebuildGeneratedCoursesFromResults(IEnumerable<Student> importedResults)
|
||||||
|
{
|
||||||
|
var importedById = importedResults
|
||||||
|
.Where(student => !string.IsNullOrWhiteSpace(student.ID))
|
||||||
|
.GroupBy(student => student.ID, StringComparer.OrdinalIgnoreCase)
|
||||||
|
.ToDictionary(group => group.Key, group => group.First(), StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
var generatedCourses = new Dictionary<(int Semester, string SportName), CourseInstance>();
|
||||||
|
|
||||||
|
foreach (var student in Settings.Instance.Students)
|
||||||
|
{
|
||||||
|
if (!importedById.TryGetValue(student.ID, out var importedStudent))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (int semesterIndex = 0; semesterIndex < 4; semesterIndex++)
|
||||||
|
{
|
||||||
|
if (importedStudent.Result.Length <= semesterIndex)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var resultName = importedStudent.Result[semesterIndex];
|
||||||
|
var sport = ResolveSportFromCourseName(resultName);
|
||||||
|
if (sport == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var key = (semesterIndex + 1, sport.Name);
|
||||||
|
if (!generatedCourses.TryGetValue(key, out var course))
|
||||||
|
{
|
||||||
|
course = new CourseInstance
|
||||||
|
{
|
||||||
|
Sport = sport,
|
||||||
|
Students = new List<string>()
|
||||||
|
};
|
||||||
|
generatedCourses[key] = course;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!course.Students.Contains(student.ID))
|
||||||
|
course.Students.Add(student.ID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GeneratedCourses = generatedCourses
|
||||||
|
.Select(entry => (Semester: entry.Key.Semester, Instance: entry.Value))
|
||||||
|
.OrderBy(course => course.Semester)
|
||||||
|
.ThenBy(course => course.Instance.Sport.Name)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
public static void Craft()
|
public static void Craft()
|
||||||
{
|
{
|
||||||
GeneratedCourses = new();
|
GeneratedCourses = new();
|
||||||
@@ -148,7 +208,7 @@ public class CourseCrafter
|
|||||||
for (int semester = 1; semester <= 4; semester++)
|
for (int semester = 1; semester <= 4; semester++)
|
||||||
{
|
{
|
||||||
int cancel = 0;
|
int cancel = 0;
|
||||||
while (GeneratedCourses.Count(c => c.Semester == semester) < Settings.Instance.NumCoursesPerSemester)
|
while (GeneratedCourses.Count(c => c.Semester == semester) < Settings.Instance.NumCoursesPerSemester[semester-1])
|
||||||
{
|
{
|
||||||
cancel++;
|
cancel++;
|
||||||
if (cancel >= 20) break;
|
if (cancel >= 20) break;
|
||||||
@@ -349,7 +409,9 @@ public class CourseCrafter
|
|||||||
bool requestExit()
|
bool requestExit()
|
||||||
{
|
{
|
||||||
globalCount++;
|
globalCount++;
|
||||||
if (GeneratedCourses.Count >= Settings.Instance.NumCoursesPerSemester * 4) return true;
|
int sum = Settings.Instance.NumCoursesPerSemester[0] + Settings.Instance.NumCoursesPerSemester[1] +
|
||||||
|
Settings.Instance.NumCoursesPerSemester[2] + Settings.Instance.NumCoursesPerSemester[3];
|
||||||
|
if (GeneratedCourses.Count >= sum) return true;
|
||||||
|
|
||||||
int low = 0;
|
int low = 0;
|
||||||
foreach (var item in initial_sportlist)
|
foreach (var item in initial_sportlist)
|
||||||
@@ -440,7 +502,7 @@ public class CourseCrafter
|
|||||||
if (sportCoursesInSemester >= sport.Semester[semesterIndex])
|
if (sportCoursesInSemester >= sport.Semester[semesterIndex])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (GeneratedCourses.Count(c => c.Semester == semester) >= Settings.Instance.NumCoursesPerSemester)
|
if (GeneratedCourses.Count(c => c.Semester == semester) >= Settings.Instance.NumCoursesPerSemester[semester-1])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var directlyPlaceable = remainingStudents
|
var directlyPlaceable = remainingStudents
|
||||||
@@ -649,52 +711,7 @@ public class CourseCrafter
|
|||||||
|
|
||||||
Sport? ResolveSportFromSelection(string selectedCourseName)
|
Sport? ResolveSportFromSelection(string selectedCourseName)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(selectedCourseName) ||
|
return ResolveSportFromCourseName(selectedCourseName);
|
||||||
string.Equals(selectedCourseName, "null", StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return Settings.Instance.Sports
|
|
||||||
.FirstOrDefault(sport => sport.AlternativeNames.Contains(selectedCourseName));
|
|
||||||
}
|
|
||||||
|
|
||||||
int getSemesterForSport2(Sport sp, List<string> interestedStudents)
|
|
||||||
{
|
|
||||||
int[] semcount = new int[4];
|
|
||||||
|
|
||||||
foreach (var inst in GeneratedCourses)
|
|
||||||
semcount[inst.Semester - 1]++;
|
|
||||||
|
|
||||||
int bestSem = 0;
|
|
||||||
int minCourses = int.MaxValue;
|
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
|
||||||
{
|
|
||||||
if (sp.Semester[i] == 0) continue;
|
|
||||||
|
|
||||||
int sportCoursesInSemester = GeneratedCourses
|
|
||||||
.Count(g => g.Semester == i + 1 && g.Instance.Sport.Name == sp.Name);
|
|
||||||
|
|
||||||
if (sportCoursesInSemester >= sp.Semester[i])
|
|
||||||
continue;
|
|
||||||
|
|
||||||
int freeInterestedStudents = interestedStudents
|
|
||||||
.Distinct()
|
|
||||||
.Count(studentId => !students_in_semester[i].Contains(studentId));
|
|
||||||
|
|
||||||
if (freeInterestedStudents < getEffectiveMinStudents(sp, i + 1))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (semcount[i] < Settings.Instance.NumCoursesPerSemester &&
|
|
||||||
semcount[i] < minCourses)
|
|
||||||
{
|
|
||||||
minCourses = semcount[i];
|
|
||||||
bestSem = i + 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return bestSem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int getSemesterForSport(Sport sp, List<string> interestedStudents)
|
int getSemesterForSport(Sport sp, List<string> interestedStudents)
|
||||||
@@ -721,7 +738,7 @@ public class CourseCrafter
|
|||||||
if (sportCoursesInThisSemester >= sp.Semester[i])
|
if (sportCoursesInThisSemester >= sp.Semester[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (totalCoursesPerSemester[i] >= Settings.Instance.NumCoursesPerSemester)
|
if (totalCoursesPerSemester[i] >= Settings.Instance.NumCoursesPerSemester[i])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
int freeInterestedStudents = interestedStudents
|
int freeInterestedStudents = interestedStudents
|
||||||
@@ -744,6 +761,11 @@ public class CourseCrafter
|
|||||||
return bestSem;
|
return bestSem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReloadResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ReloadResult()
|
||||||
|
{
|
||||||
var errors = ValidateCourses(GeneratedCourses);
|
var errors = ValidateCourses(GeneratedCourses);
|
||||||
|
|
||||||
if (errors.Count == 0)
|
if (errors.Count == 0)
|
||||||
|
|||||||
+48
@@ -1,9 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Text.Json;
|
||||||
|
|
||||||
namespace spplus;
|
namespace spplus;
|
||||||
|
|
||||||
public static class ExportUtility
|
public static class ExportUtility
|
||||||
{
|
{
|
||||||
|
private sealed class ConfigurationExport
|
||||||
|
{
|
||||||
|
public List<Sport> Sports { get; set; } = [];
|
||||||
|
public int[] NumCoursesPerSemester { get; set; } = [];
|
||||||
|
}
|
||||||
|
|
||||||
public static void ExportToCSV(string filepath)
|
public static void ExportToCSV(string filepath)
|
||||||
{
|
{
|
||||||
char separator = ',';
|
char separator = ',';
|
||||||
@@ -16,4 +26,42 @@ public static class ExportUtility
|
|||||||
|
|
||||||
File.WriteAllText(filepath, output);
|
File.WriteAllText(filepath, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private sealed class ResultExportEntry
|
||||||
|
{
|
||||||
|
public int Semester { get; set; }
|
||||||
|
public string SportName { get; set; } = string.Empty;
|
||||||
|
public List<string> Students { get; set; } = new();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ExportResultsToJson(string filepath)
|
||||||
|
{
|
||||||
|
var list = CourseCrafter.GeneratedCourses
|
||||||
|
.Select(g => new ResultExportEntry
|
||||||
|
{
|
||||||
|
Semester = g.Semester,
|
||||||
|
SportName = g.Instance.Sport.Name,
|
||||||
|
Students = g.Instance.Students.ToList()
|
||||||
|
})
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
var json = JsonSerializer.Serialize(list, new JsonSerializerOptions { WriteIndented = true });
|
||||||
|
File.WriteAllText(filepath, json);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ExportConfigurationToJson(string filepath)
|
||||||
|
{
|
||||||
|
var export = new ConfigurationExport
|
||||||
|
{
|
||||||
|
Sports = Settings.Instance.Sports,
|
||||||
|
NumCoursesPerSemester = Settings.Instance.NumCoursesPerSemester
|
||||||
|
};
|
||||||
|
|
||||||
|
var json = JsonSerializer.Serialize(export, new JsonSerializerOptions
|
||||||
|
{
|
||||||
|
WriteIndented = true
|
||||||
|
});
|
||||||
|
|
||||||
|
File.WriteAllText(filepath, json);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Text.Json;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace spplus;
|
namespace spplus;
|
||||||
@@ -50,42 +51,78 @@ public static class import
|
|||||||
|
|
||||||
public static List<Student> ImportResultFromFile(string path)
|
public static List<Student> ImportResultFromFile(string path)
|
||||||
{
|
{
|
||||||
var dict = new Dictionary<string, (string Name, List<string> Courses)>();
|
var dict = new Dictionary<string, string[]>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
foreach (var line in File.ReadLines(path).Skip(1)) // Header überspringen
|
foreach (var line in File.ReadLines(path).Skip(1)) // Header überspringen
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(line))
|
if (string.IsNullOrWhiteSpace(line))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var parts = line.Split(',');
|
var parts = line.Split(',', StringSplitOptions.None);
|
||||||
if (parts.Length < 3)
|
if (parts.Length < 5)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
string nameWithId = parts[0].Trim();
|
var studentId = parts[0].Trim();
|
||||||
string course = parts[2].Replace("(2)", "").Replace("(3)", "").Replace("(4)", "").Trim();
|
dict[studentId] = new[]
|
||||||
|
{
|
||||||
int open = nameWithId.LastIndexOf('(');
|
parts[1].Trim(),
|
||||||
int close = nameWithId.LastIndexOf(')');
|
parts[2].Trim(),
|
||||||
if (open < 0 || close < 0 || close <= open)
|
parts[3].Trim(),
|
||||||
continue;
|
parts[4].Trim()
|
||||||
|
};
|
||||||
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>();
|
return dict
|
||||||
|
.Select(entry => new Student(entry.Key, string.Empty, new List<string>())
|
||||||
foreach (var (id, data) in dict)
|
|
||||||
{
|
{
|
||||||
var student = new Student(id, data.Name, data.Courses);
|
Result = entry.Value
|
||||||
result.Add(student);
|
})
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
private sealed class ResultImportEntry
|
||||||
|
{
|
||||||
|
public int Semester { get; set; }
|
||||||
|
public string SportName { get; set; } = string.Empty;
|
||||||
|
public List<string> Students { get; set; } = new();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<(int Semester, CourseCrafter.CourseInstance Instance)> ImportResultFromJson(string path)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var json = File.ReadAllText(path);
|
||||||
|
var entries = JsonSerializer.Deserialize<List<ResultImportEntry>>(json);
|
||||||
|
if (entries == null) return new();
|
||||||
|
|
||||||
|
var result = new List<(int Semester, CourseCrafter.CourseInstance Instance)>();
|
||||||
|
|
||||||
|
foreach (var e in entries)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(e.SportName))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var sport = Settings.Instance.Sports.FirstOrDefault(s =>
|
||||||
|
string.Equals(s.Name, e.SportName, StringComparison.OrdinalIgnoreCase) ||
|
||||||
|
s.AlternativeNames.Any(a => string.Equals(a, e.SportName, StringComparison.OrdinalIgnoreCase)));
|
||||||
|
|
||||||
|
if (sport == null)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var ci = new CourseCrafter.CourseInstance
|
||||||
|
{
|
||||||
|
Sport = sport,
|
||||||
|
Students = e.Students.Distinct().ToList()
|
||||||
|
};
|
||||||
|
|
||||||
|
result.Add((e.Semester, ci));
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
return new();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 106 KiB |
@@ -5,6 +5,7 @@
|
|||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ApplicationManifest>app.manifest</ApplicationManifest>
|
<ApplicationManifest>app.manifest</ApplicationManifest>
|
||||||
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
|
||||||
|
<ApplicationIcon>res/logo.ico</ApplicationIcon>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -19,4 +20,37 @@
|
|||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="Lucide.Avalonia" Version="0.1.35"/>
|
<PackageReference Include="Lucide.Avalonia" Version="0.1.35"/>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="PdfSharp">
|
||||||
|
<HintPath>lib/pdfsharp/PdfSharp.dll</HintPath>
|
||||||
|
<Private>true</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="PdfSharp.System">
|
||||||
|
<HintPath>lib/pdfsharp/PdfSharp.System.dll</HintPath>
|
||||||
|
<Private>true</Private>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Microsoft.Extensions.Logging.Abstractions">
|
||||||
|
<HintPath>lib/pdfsharp/Microsoft.Extensions.Logging.Abstractions.dll</HintPath>
|
||||||
|
<Private>true</Private>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Remove="res\logo.ico"/>
|
||||||
|
<AvaloniaResource Include="res\logo.ico">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</AvaloniaResource>
|
||||||
|
<None Remove="res\logo.png"/>
|
||||||
|
<AvaloniaResource Include="res\logo.png">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</AvaloniaResource>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="res/fonts/*.ttf">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
+17
-14
@@ -85,7 +85,7 @@ public class Settings
|
|||||||
|
|
||||||
public List<Student> Students { get; set; } = [];
|
public List<Student> Students { get; set; } = [];
|
||||||
public List<Sport> Sports { get; set; } = [];
|
public List<Sport> Sports { get; set; } = [];
|
||||||
public int NumCoursesPerSemester { get; set; } = 10; // Exact Amount of courses, not a maximum
|
public int[] NumCoursesPerSemester { get; set; } = [10,10,11,11]; // Exact Amount of courses, not a maximum
|
||||||
|
|
||||||
public Settings()
|
public Settings()
|
||||||
{
|
{
|
||||||
@@ -99,19 +99,22 @@ public class Settings
|
|||||||
|
|
||||||
public static void ImportInitial()
|
public static void ImportInitial()
|
||||||
{
|
{
|
||||||
Instance.Sports.Add(new Sport("Tischtennis"){ AlternativeNames = {"Sport_TT"}});
|
Instance.Sports.Clear();
|
||||||
Instance.Sports.Add(new Sport("Badminton"){ AlternativeNames = {"Sport_BM"}});
|
|
||||||
Instance.Sports.Add(new Sport("Gymnastik/Tanz"){ AlternativeNames = {"Sport_Gym"}});
|
int id = 1;
|
||||||
Instance.Sports.Add(new Sport("Schwimmen"){ AlternativeNames = {"Sport_SW"}, Semester = [1, 1, 1, 1], MaxStudents = 18});
|
Instance.Sports.Add(new Sport("Tischtennis"){ ID = id++, AlternativeNames = {"Sport_TT"}});
|
||||||
Instance.Sports.Add(new Sport("Bouldern"){ AlternativeNames = {"Sport_BO"}, Semester = [1, 1, 1, 1]});
|
Instance.Sports.Add(new Sport("Badminton"){ ID = id++, AlternativeNames = {"Sport_BM"}});
|
||||||
Instance.Sports.Add(new Sport("Basketball"){ AlternativeNames = {"Sport_BS"}});
|
Instance.Sports.Add(new Sport("Gymnastik/Tanz"){ ID = id++, AlternativeNames = {"Sport_Gym"}});
|
||||||
Instance.Sports.Add(new Sport("Fitness"){ AlternativeNames = {"Sport_Fit"}});
|
Instance.Sports.Add(new Sport("Schwimmen"){ ID = id++, AlternativeNames = {"Sport_SW"}, Semester = [1, 1, 1, 1], MaxStudents = 18});
|
||||||
Instance.Sports.Add(new Sport("Fußball"){ AlternativeNames = {"Sport_Fuß"}, Semester = [1, 0, 1, 0]});
|
Instance.Sports.Add(new Sport("Bouldern"){ ID = id++, AlternativeNames = {"Sport_BO"}, Semester = [1, 1, 1, 1]});
|
||||||
Instance.Sports.Add(new Sport("Handball"){ AlternativeNames = {"Sport_HB"}});
|
Instance.Sports.Add(new Sport("Basketball"){ ID = id++, AlternativeNames = {"Sport_BS"}});
|
||||||
Instance.Sports.Add(new Sport("Leichtathletik"){ AlternativeNames = {"Sport_LA"}, Semester = [1, 0, 1, 0], MaxStudents = 18});
|
Instance.Sports.Add(new Sport("Fitness"){ ID = id++, AlternativeNames = {"Sport_Fit"}});
|
||||||
Instance.Sports.Add(new Sport("Tennis"){ AlternativeNames = {"Sport_Te"}});
|
Instance.Sports.Add(new Sport("Fußball"){ ID = id++, AlternativeNames = {"Sport_Fuß"}, Semester = [1, 0, 1, 0]});
|
||||||
Instance.Sports.Add(new Sport("Turnen"){ AlternativeNames = {"Sport_Tur"}});
|
Instance.Sports.Add(new Sport("Handball"){ ID = id++, AlternativeNames = {"Sport_HB"}});
|
||||||
Instance.Sports.Add(new Sport("Volleyball"){ AlternativeNames = {"Sport_VB"}});
|
Instance.Sports.Add(new Sport("Leichtathletik"){ ID = id++, AlternativeNames = {"Sport_LA"}, Semester = [1, 0, 1, 0], MaxStudents = 18});
|
||||||
|
Instance.Sports.Add(new Sport("Tennis"){ ID = id++, AlternativeNames = {"Sport_Te"}});
|
||||||
|
Instance.Sports.Add(new Sport("Turnen"){ ID = id++, AlternativeNames = {"Sport_Tur"}});
|
||||||
|
Instance.Sports.Add(new Sport("Volleyball"){ ID = id++, AlternativeNames = {"Sport_VB"}});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string? GetSportNameFromID(int id)
|
public static string? GetSportNameFromID(int id)
|
||||||
|
|||||||
Reference in New Issue
Block a user