public void GCResultsGapsMatcher(List <RiderGCResults> iGCResults, Riders iRider) { List <Stageraces> AllStageRaces = Singleton_Class.ListofPCTStageRaces; AllStageRaces.AddRange(Singleton_Class.ListofStageRaces); foreach (var stagerace in AllStageRaces) { List <GCGapsForRiderOnMountainStage> GapsOfRidersInRace = new List <GCGapsForRiderOnMountainStage>(); foreach (var result in iGCResults) { if (result.NameofGCRace.Contains(stagerace.Racename) && result.DateofGC.Year == stagerace.Stageresults[0].Dates.Year) { for (int x = 0; x < stagerace.GeneralClassificationBreakdown.Count; x++) { if (stagerace.GeneralClassificationBreakdown[x].NameofRider.Contains(iRider.Fullname)) { foreach (int gap in stagerace.GeneralClassificationBreakdown[x].ListOfGCGapsPerStage) { GCGapsForRiderOnMountainStage GapOnstage = new GCGapsForRiderOnMountainStage(); GapOnstage.GapOnStage = gap; } } } } } } }
public void RaceLengthPearsonsCoefficient(Riders iRider) { List <RiderResults> PCTTotalResults = iRider._PCTStageRaceStageResults; List <RiderResults> PCTOneDayResults = iRider._PCTOneDayRaceResults; PCTTotalResults.AddRange(PCTOneDayResults); iRider._PCTPearsonsRankLength = RaceLengthPearsonsCalculator(PCTTotalResults); List <RiderResults> WTTotalResults = iRider.riderstageraceresult; List <RiderResults> WTOneDayResults = iRider.riderresult; WTTotalResults.AddRange(WTOneDayResults); iRider.WTPearsonsRankLength = RaceLengthPearsonsCalculator(WTTotalResults); }
public float ClimbingRating(Riders iRider) { float StandardDeviation = iRider.FurtherMetrics.StandardDeviationInMountainStages; float averageclimbingposition; List <RiderResults> ResultsofRider = iRider.RiderStageRaceResult; ResultsofRider.AddRange(PCTStageRaceStageResults); List <RiderResults> StageResults = new List <RiderResults>(); foreach (var result in ResultsofRider) { if (result.Racedifficulty > 175) { StageResults.Add(result); } } float resultsmean = 0; for (int x = 0; x < StageResults.Count; x++) { if (StageResults[x].Position.Contains("DNF") || StageResults[x].Position.Contains("OTL") || StageResults[x].Position.Equals("") || StageResults[x].Position.Contains("DNS")) { float BadResult = 100; resultsmean = resultsmean + BadResult; } else { float Result = float.Parse(StageResults[x].Position); resultsmean = resultsmean + Result; } } averageclimbingposition = resultsmean / StageResults.Count; float ClimbingRating = (150 - averageclimbingposition) - (iRider.FurtherMetrics.StandardDeviationInMountainStages / 2) * (iRider.ClimbingPearsonsrankcoefficient + 1); return(ClimbingRating); }
public static void Calculations() { foreach (var rider in Singleton_Class.ListofRiders) { List <RiderResults> StoreofAllresults = new List <RiderResults>(); StoreofAllresults.AddRange(rider.PCTOneDayRaceResults); StoreofAllresults.AddRange(rider.PCTStageRaceStageResults); StoreofAllresults.AddRange(rider.RiderStageRaceResult); StoreofAllresults.AddRange(rider.Riderresult); rider.ClimbingPearsonsrankcoefficient = regressionmodelclimbing(StoreofAllresults); rider.RaceLengthPearsonsCoefficient(rider); } Riders riders = new Riders(); riders.CobbledConsistency(Singleton_Class.ListofRiders); foreach (var rider in Singleton_Class.ListofRiders) { rider.FurtherMetrics.ClimbingRating = rider.ClimbingRating(rider); } Console.ReadLine(); }