Scale lesson skill gain by the teacher's subject skill.
Hiring a 78-math applicant already cost more than a 41; the class now actually learns faster when that teacher is in the room. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -129,6 +129,67 @@ public class LessonTeacherPresentTests
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WeakTeacher_GainsLessThanStrong()
|
||||
{
|
||||
var (school, homeroom, pupilId, teacherId) = StaffedMath();
|
||||
using (school)
|
||||
{
|
||||
AdvanceTo(school, LessonStart);
|
||||
SetPlace(school, pupilId, homeroom);
|
||||
SetPlace(school, teacherId, homeroom);
|
||||
SetSkill(school, teacherId, "Mathematics", 20);
|
||||
var beforeWeak = SkillOf(school, pupilId, "Mathematics");
|
||||
LessonLearningSystem.Apply(school, 45);
|
||||
var weakGain = SkillOf(school, pupilId, "Mathematics") - beforeWeak;
|
||||
|
||||
SetSkill(school, pupilId, "Mathematics", beforeWeak);
|
||||
SetSkill(school, teacherId, "Mathematics", 80);
|
||||
var beforeStrong = SkillOf(school, pupilId, "Mathematics");
|
||||
LessonLearningSystem.Apply(school, 45);
|
||||
var strongGain = SkillOf(school, pupilId, "Mathematics") - beforeStrong;
|
||||
|
||||
Assert.True(weakGain > 0);
|
||||
Assert.True(strongGain > weakGain);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MissingTeacherSkillKey_StillGains()
|
||||
{
|
||||
var (school, homeroom, pupilId, teacherId) = StaffedMath();
|
||||
using (school)
|
||||
{
|
||||
AdvanceTo(school, LessonStart);
|
||||
SetPlace(school, pupilId, homeroom);
|
||||
SetPlace(school, teacherId, homeroom);
|
||||
ClearSkill(school, teacherId, "Mathematics");
|
||||
var before = SkillOf(school, pupilId, "Mathematics");
|
||||
|
||||
LessonLearningSystem.Apply(school, 45);
|
||||
|
||||
Assert.True(SkillOf(school, pupilId, "Mathematics") > before);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TeacherSkill_DoesNotRescueAbsence()
|
||||
{
|
||||
var (school, homeroom, pupilId, teacherId) = StaffedMath();
|
||||
using (school)
|
||||
{
|
||||
AdvanceTo(school, LessonStart);
|
||||
SetPlace(school, pupilId, homeroom);
|
||||
SetPlace(school, teacherId, "restroom-1");
|
||||
SetSkill(school, teacherId, "Mathematics", 100);
|
||||
var before = SkillOf(school, pupilId, "Mathematics");
|
||||
|
||||
LessonLearningSystem.Apply(school, 45);
|
||||
|
||||
Assert.Equal(before, SkillOf(school, pupilId, "Mathematics"));
|
||||
}
|
||||
}
|
||||
|
||||
private static (School School, string Homeroom, string PupilId, string TeacherId) StaffedMath(
|
||||
string? teacherId = null)
|
||||
{
|
||||
@@ -206,6 +267,34 @@ public class LessonTeacherPresentTests
|
||||
return value;
|
||||
}
|
||||
|
||||
private static void SetSkill(School school, string personId, string skill, float value)
|
||||
{
|
||||
var query = new QueryDescription().WithAll<PersonIdentity, PersonSkills>();
|
||||
school.World.Query(
|
||||
in query,
|
||||
(ref PersonIdentity identity, ref PersonSkills skills) =>
|
||||
{
|
||||
if (identity.Id.Equals(personId, StringComparison.Ordinal))
|
||||
{
|
||||
skills.Values[skill] = value;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void ClearSkill(School school, string personId, string skill)
|
||||
{
|
||||
var query = new QueryDescription().WithAll<PersonIdentity, PersonSkills>();
|
||||
school.World.Query(
|
||||
in query,
|
||||
(ref PersonIdentity identity, ref PersonSkills skills) =>
|
||||
{
|
||||
if (identity.Id.Equals(personId, StringComparison.Ordinal))
|
||||
{
|
||||
skills.Values.Remove(skill);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static (DefCatalog Catalog, MapLayout Map) Vanilla()
|
||||
{
|
||||
var root = Path.Combine(AppContext.BaseDirectory, "vanilla");
|
||||
|
||||
Reference in New Issue
Block a user