This commit is contained in:
1 parent
45b7a2b7e6
commit
960d52686a
8 files changed
+98
-51
No files matched your search
@@ -5,6 +5,7 @@ using LehrerApp.Core.AiPlanning;
|
||||
using LehrerApp.Core.Interfaces;
|
||||
using LehrerApp.Core.Models;
|
||||
using LehrerApp.Desktop.Services;
|
||||
using LehrerApp.Desktop.ViewModels.ClassTeacher;
|
||||
|
||||
namespace LehrerApp.Desktop.ViewModels.Groups;
|
||||
|
||||
@@ -122,11 +123,7 @@ public partial class WebUntisLessonAbsenceComparisonViewModel : ObservableObject
|
||||
var byKey = courseStudents.Select(student => (Student: student, Key: UntisLessonAbsenceHelper.StudentExternKey(student)))
|
||||
.Where(x => x.Key is not null).ToDictionary(x => x.Key!.Value, x => x.Student);
|
||||
var byName = courseStudents
|
||||
.SelectMany(student => new[]
|
||||
{
|
||||
NameKey($"{student.LastName} {student.FirstName}"),
|
||||
NameKey($"{student.FirstName} {student.LastName}"),
|
||||
}.Select(key => (Key: key, Student: student)))
|
||||
.Select(student => (Key: UntisNameMatching.NameKey(student.FullName), Student: student))
|
||||
.GroupBy(x => x.Key)
|
||||
.Where(group => group.Select(x => x.Student).Distinct().Count() == 1)
|
||||
.ToDictionary(group => group.Key, group => group.First().Student);
|
||||
@@ -155,7 +152,7 @@ public partial class WebUntisLessonAbsenceComparisonViewModel : ObservableObject
|
||||
{
|
||||
var match = absence.ExternKey is { } key && byKey.TryGetValue(key, out var byKeyStudent)
|
||||
? byKeyStudent
|
||||
: byName.GetValueOrDefault(NameKey(absence.StudentName));
|
||||
: byName.GetValueOrDefault(UntisNameMatching.NameKey(absence.StudentName));
|
||||
var targetStatus = MapStatus(absence);
|
||||
var row = new WebUntisLessonAbsenceRow
|
||||
{
|
||||
@@ -281,11 +278,6 @@ public partial class WebUntisLessonAbsenceComparisonViewModel : ObservableObject
|
||||
return filled;
|
||||
}
|
||||
|
||||
// Groß-/Kleinschreibung, Leerraum und - da die tatsächliche WebUntis-Reihenfolge nicht
|
||||
// dokumentiert und schulabhängig unterschiedlich beobachtet wurde - beide Namensreihenfolgen
|
||||
// werden beim Aufbau von `byName` registriert; hier wird nur normalisiert.
|
||||
private static string NameKey(string value) => value.Trim().ToLowerInvariant();
|
||||
|
||||
// MapStatus/StudentKey leben jetzt in UntisLessonAbsenceHelper (framework-frei), damit
|
||||
// UntisComparisonTools (MCP) exakt dieselbe Regel verwendet statt eines eigenen Duplikats, das
|
||||
// aus dem Tritt geraten könnte.
|
||||
|
||||
Reference in new issue
Block a user