#27 -- fix statistic
This commit is contained in:
parent
97433f9e73
commit
49e906c190
@ -27,19 +27,20 @@ public class StatisticController {
|
|||||||
|
|
||||||
@GetMapping(STATISTIC)
|
@GetMapping(STATISTIC)
|
||||||
public String indexBranch(Model model) {
|
public String indexBranch(Model model) {
|
||||||
|
List<Object[]> urlCommits = getUrlCommits();
|
||||||
|
List<Object[]> timeCommits = getTimeCommits();
|
||||||
model.addAttribute("commitAuthorData", authorCommits());
|
model.addAttribute("commitAuthorData", authorCommits());
|
||||||
model.addAttribute("commitUrlData", urlCommits());
|
model.addAttribute("commitUrlData", urlCommits);
|
||||||
model.addAttribute("commitTimeData", timeCommits());
|
model.addAttribute("commitTimeData", timeCommits);
|
||||||
String[] date = new String[timeCommits().size()];
|
List<String> dates = timeCommits.stream()
|
||||||
for (int i = 0; i < timeCommits().size(); i++) {
|
.map(tc -> tc[0].toString())
|
||||||
date[i] = timeCommits().get(i)[0].toString();
|
.collect(Collectors.toList());
|
||||||
}
|
model.addAttribute("dates", dates);
|
||||||
model.addAttribute("dates", date);
|
|
||||||
String[] url = new String[urlCommits().size()];
|
List<String> urls = urlCommits.stream()
|
||||||
for (int i = 0; i < urlCommits().size(); i++) {
|
.map(tc -> tc[0].toString().substring(tc[0].toString().lastIndexOf("/") + 1))
|
||||||
url[i] = urlCommits().get(i)[0].toString().substring(urlCommits().get(i)[0].toString().lastIndexOf("/") + 1);
|
.collect(Collectors.toList());
|
||||||
}
|
model.addAttribute("urls", urls);
|
||||||
model.addAttribute("urls", url);
|
|
||||||
model.addAttribute("commitEntityData", entityCommits());
|
model.addAttribute("commitEntityData", entityCommits());
|
||||||
model.addAttribute("commitTimeEntityData", allTimeEntityCommits());
|
model.addAttribute("commitTimeEntityData", allTimeEntityCommits());
|
||||||
return STATISTIC;
|
return STATISTIC;
|
||||||
@ -52,14 +53,14 @@ public class StatisticController {
|
|||||||
return authorCommits;
|
return authorCommits;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Object[]> urlCommits() {
|
public List<Object[]> getUrlCommits() {
|
||||||
List<Object[]> urlCommits = commitRepository.getCommitUrlStatistic().stream()
|
List<Object[]> urlCommits = commitRepository.getCommitUrlStatistic().stream()
|
||||||
.map(stat -> new Object[]{stat.getUrl(), stat.getCountCommit()})
|
.map(stat -> new Object[]{stat.getUrl(), stat.getCountCommit()})
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
return urlCommits;
|
return urlCommits;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Object[]> timeCommits() {
|
public List<Object[]> getTimeCommits() {
|
||||||
List<Object[]> timeCommits = commitRepository.getCommitTimeStatistic().stream()
|
List<Object[]> timeCommits = commitRepository.getCommitTimeStatistic().stream()
|
||||||
.map(stat -> new Object[]{stat.getDate(), stat.getCountCommit()})
|
.map(stat -> new Object[]{stat.getDate(), stat.getCountCommit()})
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
Loading…
Reference in New Issue
Block a user