Merge remote-tracking branch 'origin/master' into master
This commit is contained in:
commit
0bd1e9e145
@ -27,28 +27,46 @@ public class StatisticController {
|
||||
|
||||
@GetMapping(STATISTIC)
|
||||
public String indexBranch(Model model) {
|
||||
model.addAttribute("commitAuthorData", authorCommits());
|
||||
model.addAttribute("commitUrlData", urlCommits());
|
||||
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);
|
||||
String[] url = new String[urlCommits().size()];
|
||||
for (int i = 0; i < urlCommits().size(); i++) {
|
||||
url[i] = urlCommits().get(i)[0].toString().substring(urlCommits().get(i)[0].toString().lastIndexOf("/") + 1);
|
||||
}
|
||||
model.addAttribute("urls", url);
|
||||
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());
|
||||
model.addAttribute("commitAuthorData", authorCommits);
|
||||
return authorCommits;
|
||||
}
|
||||
|
||||
public List<Object[]> urlCommits() {
|
||||
List<Object[]> urlCommits = commitRepository.getCommitUrlStatistic().stream()
|
||||
.map(stat -> new Object[]{stat.getUrl(), stat.getCountCommit()})
|
||||
.collect(Collectors.toList());
|
||||
model.addAttribute("commitUrlData", urlCommits);
|
||||
return urlCommits;
|
||||
}
|
||||
|
||||
public List<Object[]> timeCommits() {
|
||||
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);
|
||||
String[] url = new String[urlCommits.size()];
|
||||
for (int i = 0; i < urlCommits.size(); i++) {
|
||||
url[i] = urlCommits.get(i)[0].toString().substring(urlCommits.get(i)[0].toString().lastIndexOf("/") + 1);
|
||||
}
|
||||
model.addAttribute("urls", url);
|
||||
return timeCommits;
|
||||
}
|
||||
|
||||
public List<Object[]> entityCommits() {
|
||||
List<Object[]> entityCommits = commitRepository.getCommitEntityStatistic().stream()
|
||||
.map(stat -> new Object[]{stat.getEntity(), stat.getCountCommit()})
|
||||
.collect(Collectors.toList());
|
||||
@ -59,17 +77,24 @@ public class StatisticController {
|
||||
? "Нет данных"
|
||||
: "Нет сущностей");
|
||||
}
|
||||
model.addAttribute("commitEntityData", entityCommits);
|
||||
return entityCommits;
|
||||
}
|
||||
|
||||
public List<Object[]> timeEntityCommits() {
|
||||
List<Object[]> timeEntityCommits = commitRepository.getCommitTimeEntityStatistic().stream()
|
||||
.map(stat -> new Object[]{stat.getDate(), stat.getCountCommit()})
|
||||
.collect(Collectors.toList());
|
||||
return timeEntityCommits;
|
||||
}
|
||||
|
||||
public List<Object[]> allTimeEntityCommits() {
|
||||
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];
|
||||
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) {
|
||||
@ -77,7 +102,6 @@ public class StatisticController {
|
||||
}
|
||||
}
|
||||
}
|
||||
model.addAttribute("commitTimeEntityData", allTimeEntityCommits);
|
||||
return STATISTIC;
|
||||
return allTimeEntityCommits;
|
||||
}
|
||||
}
|
||||
|
@ -79,44 +79,6 @@
|
||||
$('#container').highcharts(json);
|
||||
});
|
||||
</script>
|
||||
<script th:inline="javascript">
|
||||
$(document).ready(function () {
|
||||
var chart = {
|
||||
plotBackgroundColor: null,
|
||||
plotBorderWidth: null,
|
||||
plotShadow: false
|
||||
};
|
||||
var title = {
|
||||
text: '% коммитов авторов'
|
||||
};
|
||||
var tooltip = {
|
||||
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
|
||||
};
|
||||
var plotOptions = {
|
||||
pie: {
|
||||
allowPointSelect: true,
|
||||
cursor: 'pointer',
|
||||
dataLabels: {
|
||||
enabled: false
|
||||
},
|
||||
showInLegend: true
|
||||
}
|
||||
};
|
||||
var series = [{
|
||||
type: 'pie',
|
||||
name: 'Browser share',
|
||||
data: [[${commitAuthorData}]]
|
||||
}];
|
||||
|
||||
var json = {};
|
||||
json.chart = chart;
|
||||
json.title = title;
|
||||
json.tooltip = tooltip;
|
||||
json.series = series;
|
||||
json.plotOptions = plotOptions;
|
||||
$('#containerPie').highcharts(json);
|
||||
});
|
||||
</script>
|
||||
<script th:inline="javascript">
|
||||
$(document).ready(function () {
|
||||
var chart = {
|
||||
@ -175,14 +137,14 @@
|
||||
});
|
||||
</script>
|
||||
<script th:inline="javascript">
|
||||
$(document).ready(function () {
|
||||
function createPie(data, title) {
|
||||
var chart = {
|
||||
plotBackgroundColor: null,
|
||||
plotBorderWidth: null,
|
||||
plotShadow: false
|
||||
};
|
||||
var title = {
|
||||
text: '% коммитов содержащих сущности'
|
||||
text: title
|
||||
};
|
||||
var tooltip = {
|
||||
pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
|
||||
@ -200,7 +162,7 @@
|
||||
var series = [{
|
||||
type: 'pie',
|
||||
name: 'Browser share',
|
||||
data: [[${commitEntityData}]]
|
||||
data: data
|
||||
}];
|
||||
|
||||
var json = {};
|
||||
@ -209,7 +171,11 @@
|
||||
json.tooltip = tooltip;
|
||||
json.series = series;
|
||||
json.plotOptions = plotOptions;
|
||||
$('#containerEntityPie').highcharts(json);
|
||||
return json;
|
||||
};
|
||||
$(document).ready(function () {
|
||||
$('#containerPie').highcharts(createPie([[${commitAuthorData}]], '% коммитов авторов'));
|
||||
$('#containerEntityPie').highcharts(createPie([[${commitEntityData}]], '% коммитов содержащих сущности'));
|
||||
});
|
||||
</script>
|
||||
<div class="row">
|
||||
|
Loading…
Reference in New Issue
Block a user