#22 - Change statistic pie
This commit is contained in:
parent
2cb0ad15ba
commit
8b9822de19
@ -50,7 +50,18 @@ public class StatisticController {
|
||||
List<Object[]> entityCommits = commitRepository.getCommitEntityStatistic().stream()
|
||||
.map(stat -> new Object[]{stat.getEntity(), stat.getCountCommit()})
|
||||
.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
|
||||
? "Нет данных"
|
||||
: "Нет сущностей");
|
||||
}
|
||||
model.addAttribute("commitEntityData", entityCommits);
|
||||
List<Object[]> timeEntityCommits = commitRepository.getCommitTimeEntityStatistic().stream()
|
||||
.map(stat -> new Object[]{stat.getDate(), stat.getCountCommit()})
|
||||
.collect(Collectors.toList());
|
||||
model.addAttribute("commitTimeEntityData", timeEntityCommits);
|
||||
return STATISTIC;
|
||||
}
|
||||
}
|
||||
|
@ -35,4 +35,7 @@ public interface CommitRepository extends JpaRepository<Commit, Integer> {
|
||||
@Query("SELECT new ru.ulstu.extractor.model.CommitEntityStatistic(f.containsEntity, COUNT(DISTINCT c.hash)) FROM FileChange f, Commit c WHERE f MEMBER OF c.fileChanges GROUP by f.containsEntity")
|
||||
List<CommitEntityStatistic> getCommitEntityStatistic();
|
||||
|
||||
@Query("SELECT new ru.ulstu.extractor.model.CommitTimeStatistic(cast(c.date as date), COUNT(DISTINCT c.hash)) FROM Commit c, FileChange f WHERE f MEMBER OF c.fileChanges AND f.containsEntity = true GROUP by cast(c.date as date) ORDER by cast(c.date as date)")
|
||||
List<CommitTimeStatistic> getCommitTimeEntityStatistic();
|
||||
|
||||
}
|
||||
|
@ -15,10 +15,6 @@
|
||||
<script src="/webjars/highcharts/7.0.0/highcharts.js"></script>
|
||||
<script th:inline="javascript">
|
||||
$(document).ready(function () {
|
||||
var chart = {
|
||||
type: 'scatter',
|
||||
zoomType: 'xy'
|
||||
};
|
||||
var title = {
|
||||
text: 'Количество коммитов во времени'
|
||||
};
|
||||
@ -66,11 +62,15 @@
|
||||
name: 'Коммиты',
|
||||
color: 'rgba(119,152,191,0.5)',
|
||||
data: [[${commitTimeData}]]
|
||||
},
|
||||
{
|
||||
name: 'Сущности',
|
||||
color: 'rgba(255,0,0,0.5)',
|
||||
data: [[${commitTimeEntityData}]]
|
||||
}
|
||||
];
|
||||
|
||||
var json = {};
|
||||
json.chart = chart;
|
||||
json.title = title;
|
||||
json.xAxis = xAxis;
|
||||
json.yAxis = yAxis;
|
||||
|
Loading…
Reference in New Issue
Block a user