Skip to content

Commit 83450a9

Browse files
committed
Fix readability of some code
1 parent cf9e3ec commit 83450a9

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

SportsAnalyzer/Models/Statistics.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,12 +192,13 @@ public void CalculateAll()
192192
GoalsInIntervalsPercent[i] = Round((GoalsInIntervals[i] / scoredGoalsSum) * 100, 2);
193193
}
194194

195-
int index = 0;
196-
197-
for (var i = 0; i < MatchGoals.Count; i++)
195+
int numberOfGoals = 0;
196+
double numberOfMatches = 0;
197+
foreach (var item in MatchGoals)
198198
{
199-
index = MatchGoals.Keys.ElementAt(i);
200-
MatchGoalsPct[index] = Round((MatchGoals[index] / MatchesNumber) * 100, 2);
199+
numberOfGoals = item.Key;
200+
numberOfMatches = item.Value;
201+
MatchGoalsPct[numberOfGoals] = Round((numberOfMatches / MatchesNumber) * 100, 2);
201202
}
202203
}
203204

0 commit comments

Comments
 (0)