|
|
@ -13,6 +13,8 @@ import ru.ulstu.extractor.repository.CommitRepository;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static ru.ulstu.extractor.controller.Route.STATISTIC;
|
|
|
|
|
|
|
|
|
|
|
|
@Controller
|
|
|
|
@Controller
|
|
|
|
public class StatisticController {
|
|
|
|
public class StatisticController {
|
|
|
|
private final CommitRepository commitRepository;
|
|
|
|
private final CommitRepository commitRepository;
|
|
|
@ -21,9 +23,8 @@ public class StatisticController {
|
|
|
|
this.commitRepository = commitRepository;
|
|
|
|
this.commitRepository = commitRepository;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/statistic")
|
|
|
|
@GetMapping(STATISTIC)
|
|
|
|
public String indexBranch(
|
|
|
|
public String indexBranch(Model model) {
|
|
|
|
Model model) {
|
|
|
|
|
|
|
|
List<Object[]> authorCommits = commitRepository.getCommitAuthorStatistic().stream()
|
|
|
|
List<Object[]> authorCommits = commitRepository.getCommitAuthorStatistic().stream()
|
|
|
|
.map(stat -> new Object[]{stat.getAuthor(), stat.getCountCommit()})
|
|
|
|
.map(stat -> new Object[]{stat.getAuthor(), stat.getCountCommit()})
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
.collect(Collectors.toList());
|
|
|
@ -40,13 +41,13 @@ public class StatisticController {
|
|
|
|
for (int i = 0; i < timeCommits.size(); i++) {
|
|
|
|
for (int i = 0; i < timeCommits.size(); i++) {
|
|
|
|
date[i] = timeCommits.get(i)[0].toString();
|
|
|
|
date[i] = timeCommits.get(i)[0].toString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
model.addAttribute("datas", 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();
|
|
|
|
url[i] = urlCommits.get(i)[0].toString().substring(urlCommits.get(i)[0].toString().lastIndexOf("/") + 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
model.addAttribute("urls", url);
|
|
|
|
model.addAttribute("urls", url);
|
|
|
|
|
|
|
|
|
|
|
|
return "statistic";
|
|
|
|
return STATISTIC;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|