Resolve "Страница со статистикой" #43
@ -13,6 +13,7 @@ public class Route {
|
|||||||
public static final String LIST_REPOSITORY_BRANCHES = "listBranches";
|
public static final String LIST_REPOSITORY_BRANCHES = "listBranches";
|
||||||
public static final String INDEXING_NEW_REPOSITORY = "indexNewRepository";
|
public static final String INDEXING_NEW_REPOSITORY = "indexNewRepository";
|
||||||
public static final String FILTER_COMMITS = "filterCommits";
|
public static final String FILTER_COMMITS = "filterCommits";
|
||||||
|
public static final String STATISTIC = "statistic";
|
||||||
|
|
||||||
public static String getLIST_INDEXED_REPOSITORIES() {
|
public static String getLIST_INDEXED_REPOSITORIES() {
|
||||||
return LIST_INDEXED_REPOSITORIES;
|
return LIST_INDEXED_REPOSITORIES;
|
||||||
@ -29,4 +30,8 @@ public class Route {
|
|||||||
public static String getFILTER_COMMITS() {
|
public static String getFILTER_COMMITS() {
|
||||||
return FILTER_COMMITS;
|
return FILTER_COMMITS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getSTATISTIC() {
|
||||||
|
return STATISTIC;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
text: 'Количество коммитов во времени'
|
text: 'Количество коммитов во времени'
|
||||||
};
|
};
|
||||||
var xAxis = {
|
var xAxis = {
|
||||||
categories: [[${datas}]],
|
categories: [[${dates}]],
|
||||||
title: {
|
title: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
text: 'Дата'
|
text: 'Дата'
|
||||||
@ -129,7 +129,7 @@
|
|||||||
categories: [[${urls}]],
|
categories: [[${urls}]],
|
||||||
crosshair: true,
|
crosshair: true,
|
||||||
title: {
|
title: {
|
||||||
text: 'Url'
|
text: 'Репозиторий'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var yAxis = {
|
var yAxis = {
|
||||||
@ -141,7 +141,7 @@
|
|||||||
var tooltip = {
|
var tooltip = {
|
||||||
headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
|
headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
|
||||||
pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
|
pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
|
||||||
'<td style="padding:0"><b>{point.y:.1f} mm</b></td></tr>',
|
'<td style="padding:0"><b>{point.y:.1f}</b></td></tr>',
|
||||||
footerFormat: '</table>',
|
footerFormat: '</table>',
|
||||||
shared: true,
|
shared: true,
|
||||||
useHTML: true
|
useHTML: true
|
||||||
|
Loading…
Reference in New Issue
Block a user