private void groupGames(List<GameMetrics> metrics) { int gruopSize = (int)Math.Ceiling((metrics.Count + 0.0f) / (MAX_COLUMNS + 0.0f)); this.note.text = gruopSize + (SettingsController.GetController().GetLanguage() == 0 ? " en " : " in ") + "1"; for(int i = 0; i < Math.Ceiling((metrics.Count + 0.0f) / (gruopSize + 0.0f)); i++) { List<GameMetrics> currentGroup = metrics.GetRange(i * gruopSize, (i * gruopSize + gruopSize) <= metrics.Count ? gruopSize : metrics.Count - metricsPoints.Count * gruopSize); GameMetrics currentMetric = new GameMetrics(currentGroup[0].GetArea(), currentGroup[0].GetIndex(), currentGroup[0].GetLevel()); currentMetric.SetDate(currentGroup[0].GetDate()); for(int j = 0; j < currentGroup.Count; j++) { currentMetric.SetScore(currentMetric.GetScore() + currentGroup[j].GetScore()); currentMetric.SetLapsedSeconds(currentMetric.GetLapsedSeconds() + currentGroup[j].GetLapsedSeconds()); currentMetric.SetRightAnswers(currentMetric.GetRightAnswers() + currentGroup[j].GetRightAnswers()); currentMetric.SetWrongAnswers(currentMetric.GetWrongAnswers() + currentGroup[j].GetWrongAnswers()); } currentMetric.SetScore(Average(currentMetric.GetScore(), currentGroup.Count)); currentMetric.SetLapsedSeconds(Average(currentMetric.GetLapsedSeconds(), currentGroup.Count)); currentMetric.SetRightAnswers(Average(currentMetric.GetRightAnswers(), currentGroup.Count)); currentMetric.SetWrongAnswers(Average(currentMetric.GetWrongAnswers(), currentGroup.Count)); metricsPoints.Add(currentMetric); } }