Merge branch '22-entity-diagram' into 'master'
Resolve "Добавить диаграмму для сущностей" Closes #22 See merge request romanov73/git-extractor!20
This commit is contained in:
commit
de2713e9d8
@ -47,6 +47,21 @@ public class StatisticController {
|
||||
url[i] = urlCommits.get(i)[0].toString().substring(urlCommits.get(i)[0].toString().lastIndexOf("/") + 1);
|
||||
}
|
||||
model.addAttribute("urls", url);
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ import org.springframework.data.jpa.repository.Query;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import ru.ulstu.extractor.model.Commit;
|
||||
import ru.ulstu.extractor.model.CommitAuthorStatistic;
|
||||
import ru.ulstu.extractor.model.CommitEntityStatistic;
|
||||
import ru.ulstu.extractor.model.CommitTimeStatistic;
|
||||
import ru.ulstu.extractor.model.CommitUrlStatistic;
|
||||
import ru.ulstu.extractor.model.Repository;
|
||||
@ -31,4 +32,10 @@ public interface CommitRepository extends JpaRepository<Commit, Integer> {
|
||||
@Query("SELECT new ru.ulstu.extractor.model.CommitTimeStatistic(cast(c.date as date), COUNT(DISTINCT c.hash)) FROM Commit c GROUP by cast(c.date as date) ORDER by cast(c.date as date)")
|
||||
List<CommitTimeStatistic> getCommitTimeStatistic();
|
||||
|
||||
@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;
|
||||
@ -174,10 +174,49 @@
|
||||
|
||||
});
|
||||
</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: [[${commitEntityData}]]
|
||||
}];
|
||||
|
||||
var json = {};
|
||||
json.chart = chart;
|
||||
json.title = title;
|
||||
json.tooltip = tooltip;
|
||||
json.series = series;
|
||||
json.plotOptions = plotOptions;
|
||||
$('#containerEntityPie').highcharts(json);
|
||||
});
|
||||
</script>
|
||||
<div class="row">
|
||||
<div id="container" style="width: 550px; height: 400px; margin: 0 auto"></div>
|
||||
<div id="containerPie" style="width: 550px; height: 400px; margin: 0 auto"></div>
|
||||
<div id="containerColumn" style="width: 550px; height: 400px; margin: 0 auto"></div>
|
||||
<div id="containerEntityPie" style="width: 550px; height: 400px; margin: 0 auto"></div>
|
||||
</div>
|
||||
</div>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user