This commit is contained in:
1 parent
cdb4637c65
commit
f0c0479bcb
22 files changed
+1099
-76
No files matched your search
@@ -767,26 +767,14 @@ public class AspectColumnDef
|
||||
/// Tagesform als die fachliche Kompetenz beschreibt.</summary>
|
||||
public static class ParticipationCompetencyEstimate
|
||||
{
|
||||
private const double DayHighlightAdjustment = 1.0;
|
||||
|
||||
public static int? Estimate(List<AspectRating> ratings, IReadOnlyList<AspectColumnDef> aspects, DayHighlightKind? dayHighlight)
|
||||
{
|
||||
var normalized = ratings
|
||||
.Select(r => (Rating: r, Def: aspects.FirstOrDefault(a => a.Key == r.Key)))
|
||||
.Where(x => x.Def is not null)
|
||||
.Select(x => ParticipationRatingScale.Normalize(x.Def!.ValueType, x.Rating.Value, x.Def.MaxPoints))
|
||||
.ToList();
|
||||
if (normalized.Count == 0) return null;
|
||||
|
||||
var adjustment = dayHighlight switch
|
||||
{
|
||||
DayHighlightKind.Standout => DayHighlightAdjustment,
|
||||
DayHighlightKind.Sleepy or DayHighlightKind.Rough => -DayHighlightAdjustment,
|
||||
_ => 0,
|
||||
};
|
||||
var estimate = (int)Math.Round(normalized.Average() + adjustment, MidpointRounding.AwayFromZero);
|
||||
return Math.Clamp(estimate, -2, 2);
|
||||
}
|
||||
=> LehrerApp.Core.Services.ParticipationCompetencyEstimate.Estimate(ratings,
|
||||
aspects.Select(x => new ParticipationAspect
|
||||
{
|
||||
Key = x.Key,
|
||||
ValueType = x.ValueType,
|
||||
MaxPoints = x.MaxPoints,
|
||||
}).ToList(), dayHighlight);
|
||||
}
|
||||
|
||||
public class ParticipationSessionItem
|
||||
|
||||
Reference in new issue
Block a user