Change entity pie

This commit is contained in:
Anton Romanov 2021-04-15 16:11:44 +04:00
parent 24e2b1bd00
commit 6304365ec6

View File

@ -61,7 +61,21 @@ public class StatisticController {
List<Object[]> timeEntityCommits = commitRepository.getCommitTimeEntityStatistic().stream()
.map(stat -> new Object[]{stat.getDate(), stat.getCountCommit()})
.collect(Collectors.toList());
model.addAttribute("commitTimeEntityData", timeEntityCommits);
List<Object[]> allTimeEntityCommits = commitRepository.getCommitTimeStatistic().stream()
.map(stat -> new Object[]{stat.getDate(), stat.getCountCommit()})
.collect(Collectors.toList());
int j = 0;
for (int i = 0; i < allTimeEntityCommits.size(); i++) {
if ((j < timeEntityCommits.size()) && (allTimeEntityCommits.get(i)[0].equals(timeEntityCommits.get(j)[0]))) {
allTimeEntityCommits.get(i)[1] = timeEntityCommits.get(j)[1];
j++;
} else {
if (i > 0) {
allTimeEntityCommits.get(i)[1] = allTimeEntityCommits.get(i - 1)[1];
}
}
}
model.addAttribute("commitTimeEntityData", allTimeEntityCommits);
return STATISTIC;
}
}