[chore:] removed ai-slop-test-crafting-function
This commit is contained in:
107
crafter.cs
107
crafter.cs
@@ -228,113 +228,6 @@ public class CourseCrafter
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
public static void CraftOld()
|
|
||||||
{
|
|
||||||
GeneratedCourses = new();
|
|
||||||
|
|
||||||
var settings = Settings.Instance;
|
|
||||||
var students = settings.Students;
|
|
||||||
var sports = settings.Sports;
|
|
||||||
|
|
||||||
if (students.Count == 0 || sports.Count == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
int semesterCount = sports.Max(s => s.Semester.Length);
|
|
||||||
|
|
||||||
foreach (var st in students)
|
|
||||||
st.Result = Enumerable.Repeat("Fehler", semesterCount).ToList();
|
|
||||||
|
|
||||||
var nameMap = new Dictionary<string, Sport>(StringComparer.OrdinalIgnoreCase);
|
|
||||||
foreach (var sp in sports)
|
|
||||||
{
|
|
||||||
nameMap[sp.Name] = sp;
|
|
||||||
foreach (var alt in sp.AlternativeNames)
|
|
||||||
nameMap[alt] = sp;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Nachfrage je Sport
|
|
||||||
var demand = new Dictionary<Sport, List<Student>>();
|
|
||||||
foreach (var sp in sports)
|
|
||||||
demand[sp] = new List<Student>();
|
|
||||||
|
|
||||||
foreach (var st in students)
|
|
||||||
{
|
|
||||||
foreach (var sel in st.SelectedCourseNames.Distinct())
|
|
||||||
{
|
|
||||||
if (nameMap.TryGetValue(sel, out var sp))
|
|
||||||
demand[sp].Add(st);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ===== Semesterweise echte Verteilung =====
|
|
||||||
for (int sem = 0; sem < semesterCount; sem++)
|
|
||||||
{
|
|
||||||
int remainingSemesterSlots = settings.NumCoursesPerSemester;
|
|
||||||
|
|
||||||
foreach (var sp in sports)
|
|
||||||
{
|
|
||||||
if (sem >= sp.Semester.Length)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (remainingSemesterSlots <= 0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
var interested = demand[sp]
|
|
||||||
.Where(st =>
|
|
||||||
st.Result![sem] == "Fehler" &&
|
|
||||||
!st.Result.Contains(sp.Name))
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
if (interested.Count < sp.MinStudents)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
int maxInstances = Math.Min(sp.Semester[sem], remainingSemesterSlots);
|
|
||||||
int instanceCount = 0;
|
|
||||||
int index = 0;
|
|
||||||
|
|
||||||
while (interested.Count - index >= sp.MinStudents &&
|
|
||||||
instanceCount < maxInstances)
|
|
||||||
{
|
|
||||||
var inst = new CourseInstance
|
|
||||||
{
|
|
||||||
Sport = sp,
|
|
||||||
Remaining = sp.MaxStudents
|
|
||||||
};
|
|
||||||
|
|
||||||
GeneratedCourses.Add((sem, inst));
|
|
||||||
remainingSemesterSlots--;
|
|
||||||
instanceCount++;
|
|
||||||
|
|
||||||
int filled = 0;
|
|
||||||
|
|
||||||
while (filled < sp.MaxStudents &&
|
|
||||||
index < interested.Count)
|
|
||||||
{
|
|
||||||
var st = interested[index++];
|
|
||||||
|
|
||||||
if (st.Result![sem] != "Fehler")
|
|
||||||
continue;
|
|
||||||
|
|
||||||
//inst.Students.Add(st);
|
|
||||||
inst.Remaining--;
|
|
||||||
st.Result[sem] = sp.Name;
|
|
||||||
filled++;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Falls Mindestanzahl nicht erreicht → Instanz verwerfen
|
|
||||||
if (inst.Students.Count < sp.MinStudents)
|
|
||||||
{
|
|
||||||
//foreach (var st in inst.Students)
|
|
||||||
//st.Result[sem] = "Fehler";
|
|
||||||
|
|
||||||
GeneratedCourses.Remove((sem, inst));
|
|
||||||
remainingSemesterSlots++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string GenerateStatistics()
|
public static string GenerateStatistics()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user