Beispiel #1
0
        private IEnumerable <(PickupType Type, int Points)> CalculatePointsForObjective(DailyObjective objective)
        {
            var objectsInDropZone = _dropZone.GetObjectsInDropZone();

            var allPickupClassifications = objectsInDropZone
                                           .SelectMany(o => o.Classifications);

            var pointsByType = allPickupClassifications
                               .GroupBy(pc => pc.Type, pc => pc.Points)
                               .Select(g => new { Type = g.Key, Points = g.Sum() });

            var totalPointsByType = pointsByType.Join(objective.PickupTypesWithMultiplier, arg => arg.Type, arg => arg.PickupType,
                                                      (p, d) => (p.Type, p.Points * d.Multiplier));

            return(totalPointsByType);
        }