#23-Create new methods
This commit is contained in:
parent
6304365ec6
commit
0b41ef37ae
@ -25,49 +25,74 @@ public class StatisticController {
|
|||||||
|
|
||||||
@GetMapping(STATISTIC)
|
@GetMapping(STATISTIC)
|
||||||
public String indexBranch(Model model) {
|
public String indexBranch(Model model) {
|
||||||
List<Object[]> authorCommits = commitRepository.getCommitAuthorStatistic().stream()
|
model.addAttribute("commitAuthorData", authorCommits());
|
||||||
.map(stat -> new Object[]{stat.getAuthor(), stat.getCountCommit()})
|
model.addAttribute("commitUrlData", urlCommits());
|
||||||
.collect(Collectors.toList());
|
model.addAttribute("commitTimeData", timeCommits());
|
||||||
model.addAttribute("commitAuthorData", authorCommits);
|
String[] date = new String[timeCommits().size()];
|
||||||
List<Object[]> urlCommits = commitRepository.getCommitUrlStatistic().stream()
|
for (int i = 0; i < timeCommits().size(); i++) {
|
||||||
.map(stat -> new Object[]{stat.getUrl(), stat.getCountCommit()})
|
date[i] = timeCommits().get(i)[0].toString();
|
||||||
.collect(Collectors.toList());
|
|
||||||
model.addAttribute("commitUrlData", urlCommits);
|
|
||||||
List<Object[]> timeCommits = commitRepository.getCommitTimeStatistic().stream()
|
|
||||||
.map(stat -> new Object[]{stat.getDate(), stat.getCountCommit()})
|
|
||||||
.collect(Collectors.toList());
|
|
||||||
model.addAttribute("commitTimeData", timeCommits);
|
|
||||||
String[] date = new String[timeCommits.size()];
|
|
||||||
for (int i = 0; i < timeCommits.size(); i++) {
|
|
||||||
date[i] = timeCommits.get(i)[0].toString();
|
|
||||||
}
|
}
|
||||||
model.addAttribute("dates", date);
|
model.addAttribute("dates", date);
|
||||||
String[] url = new String[urlCommits.size()];
|
String[] url = new String[urlCommits().size()];
|
||||||
for (int i = 0; i < urlCommits.size(); i++) {
|
for (int i = 0; i < urlCommits().size(); i++) {
|
||||||
url[i] = urlCommits.get(i)[0].toString().substring(urlCommits.get(i)[0].toString().lastIndexOf("/") + 1);
|
url[i] = urlCommits().get(i)[0].toString().substring(urlCommits().get(i)[0].toString().lastIndexOf("/") + 1);
|
||||||
}
|
}
|
||||||
model.addAttribute("urls", url);
|
model.addAttribute("urls", url);
|
||||||
List<Object[]> entityCommits = commitRepository.getCommitEntityStatistic().stream()
|
for (int i = 0; i < entityCommits().size(); i++) {
|
||||||
.map(stat -> new Object[]{stat.getEntity(), stat.getCountCommit()})
|
entityCommits().get(i)[0] = Boolean.TRUE.equals(entityCommits().get(i)[0])
|
||||||
.collect(Collectors.toList());
|
|
||||||
for (int i = 0; i < entityCommits.size(); i++) {
|
|
||||||
entityCommits.get(i)[0] = Boolean.TRUE.equals(entityCommits.get(i)[0])
|
|
||||||
? "Есть сущности"
|
? "Есть сущности"
|
||||||
: (entityCommits.get(i)[0] == null
|
: (entityCommits().get(i)[0] == null
|
||||||
? "Нет данных"
|
? "Нет данных"
|
||||||
: "Нет сущностей");
|
: "Нет сущностей");
|
||||||
}
|
}
|
||||||
model.addAttribute("commitEntityData", entityCommits);
|
model.addAttribute("commitEntityData", entityCommits());
|
||||||
|
model.addAttribute("commitTimeEntityData", allTimeEntityCommits());
|
||||||
|
return STATISTIC;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Object[]> authorCommits() {
|
||||||
|
List<Object[]> authorCommits = commitRepository.getCommitAuthorStatistic().stream()
|
||||||
|
.map(stat -> new Object[]{stat.getAuthor(), stat.getCountCommit()})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return authorCommits;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Object[]> urlCommits() {
|
||||||
|
List<Object[]> urlCommits = commitRepository.getCommitUrlStatistic().stream()
|
||||||
|
.map(stat -> new Object[]{stat.getUrl(), stat.getCountCommit()})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return urlCommits;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Object[]> timeCommits() {
|
||||||
|
List<Object[]> timeCommits = commitRepository.getCommitTimeStatistic().stream()
|
||||||
|
.map(stat -> new Object[]{stat.getDate(), stat.getCountCommit()})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return timeCommits;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Object[]> entityCommits() {
|
||||||
|
List<Object[]> entityCommits = commitRepository.getCommitEntityStatistic().stream()
|
||||||
|
.map(stat -> new Object[]{stat.getEntity(), stat.getCountCommit()})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
return entityCommits;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Object[]> timeEntityCommits() {
|
||||||
List<Object[]> timeEntityCommits = commitRepository.getCommitTimeEntityStatistic().stream()
|
List<Object[]> timeEntityCommits = commitRepository.getCommitTimeEntityStatistic().stream()
|
||||||
.map(stat -> new Object[]{stat.getDate(), stat.getCountCommit()})
|
.map(stat -> new Object[]{stat.getDate(), stat.getCountCommit()})
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
return timeEntityCommits;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Object[]> allTimeEntityCommits() {
|
||||||
List<Object[]> allTimeEntityCommits = commitRepository.getCommitTimeStatistic().stream()
|
List<Object[]> allTimeEntityCommits = 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());
|
||||||
int j = 0;
|
int j = 0;
|
||||||
for (int i = 0; i < allTimeEntityCommits.size(); i++) {
|
for (int i = 0; i < allTimeEntityCommits.size(); i++) {
|
||||||
if ((j < timeEntityCommits.size()) && (allTimeEntityCommits.get(i)[0].equals(timeEntityCommits.get(j)[0]))) {
|
if ((j < timeEntityCommits().size()) && (allTimeEntityCommits.get(i)[0].equals(timeEntityCommits().get(j)[0]))) {
|
||||||
allTimeEntityCommits.get(i)[1] = timeEntityCommits.get(j)[1];
|
allTimeEntityCommits.get(i)[1] = timeEntityCommits().get(j)[1];
|
||||||
j++;
|
j++;
|
||||||
} else {
|
} else {
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
@ -75,7 +100,6 @@ public class StatisticController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
model.addAttribute("commitTimeEntityData", allTimeEntityCommits);
|
return allTimeEntityCommits;
|
||||||
return STATISTIC;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user