#18 - Create CommitTimeStatistic
This commit is contained in:
parent
6c89e67ac7
commit
5e7887740d
@ -38,6 +38,10 @@ public class StatisticController {
|
|||||||
.map(stat -> new Object[]{stat.getUrl(), stat.getCountCommit()})
|
.map(stat -> new Object[]{stat.getUrl(), stat.getCountCommit()})
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
model.addAttribute("commitUrlData", urlCommits);
|
model.addAttribute("commitUrlData", urlCommits);
|
||||||
|
List<Object[]> timeCommits = commitRepository.getCommitTimeStatistic().stream()
|
||||||
|
.map(stat -> new Object[]{stat.getCountCommit(), stat.getDate()})
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
model.addAttribute("commitTimeData", timeCommits);
|
||||||
return "statistic";
|
return "statistic";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,22 @@
|
|||||||
|
package ru.ulstu.extractor.model;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class CommitTimeStatistic {
|
||||||
|
private Date date;
|
||||||
|
private Long countCommit;
|
||||||
|
|
||||||
|
public CommitTimeStatistic(Date date, Long countCommit) {
|
||||||
|
this.date = date;
|
||||||
|
this.countCommit = countCommit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getDate() {
|
||||||
|
return date;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getCountCommit() {
|
||||||
|
return countCommit;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -7,6 +7,7 @@ import org.springframework.data.jpa.repository.Query;
|
|||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
import ru.ulstu.extractor.model.Commit;
|
import ru.ulstu.extractor.model.Commit;
|
||||||
import ru.ulstu.extractor.model.CommitAuthorStatistic;
|
import ru.ulstu.extractor.model.CommitAuthorStatistic;
|
||||||
|
import ru.ulstu.extractor.model.CommitTimeStatistic;
|
||||||
import ru.ulstu.extractor.model.CommitUrlStatistic;
|
import ru.ulstu.extractor.model.CommitUrlStatistic;
|
||||||
import ru.ulstu.extractor.model.Repository;
|
import ru.ulstu.extractor.model.Repository;
|
||||||
|
|
||||||
@ -21,4 +22,8 @@ public interface CommitRepository extends JpaRepository<Commit, Integer> {
|
|||||||
|
|
||||||
@Query("SELECT new ru.ulstu.extractor.model.CommitUrlStatistic(c.branch.repository.url, COUNT(c)) FROM Commit c GROUP by c.branch.repository.url")
|
@Query("SELECT new ru.ulstu.extractor.model.CommitUrlStatistic(c.branch.repository.url, COUNT(c)) FROM Commit c GROUP by c.branch.repository.url")
|
||||||
List<CommitUrlStatistic> getCommitUrlStatistic();
|
List<CommitUrlStatistic> getCommitUrlStatistic();
|
||||||
|
|
||||||
|
@Query("SELECT new ru.ulstu.extractor.model.CommitTimeStatistic(cast(c.date as date), COUNT(c)) FROM Commit c GROUP by cast(c.date as date)")
|
||||||
|
List<CommitTimeStatistic> getCommitTimeStatistic();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@
|
|||||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">
|
||||||
</script>
|
</script>
|
||||||
<script src="https://code.highcharts.com/highcharts.js"></script>
|
<script src="https://code.highcharts.com/highcharts.js"></script>
|
||||||
<script language="JavaScript">
|
<script th:inline="javascript">
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
var chart = {
|
var chart = {
|
||||||
type: 'scatter',
|
type: 'scatter',
|
||||||
@ -111,27 +111,8 @@
|
|||||||
var series = [
|
var series = [
|
||||||
{
|
{
|
||||||
name: 'Male',
|
name: 'Male',
|
||||||
color: 'rgba(119, 152, 191, .5)',
|
color: 'rgba(119,152,191,0.5)',
|
||||||
data: [[174.0, 65.6], [175.3, 71.8], [193.5, 80.7], [186.5, 72.6],
|
data: [[174.0, 65.6], [175.3, 71.8], [193.5, 80.7], [186.5, 72.6]
|
||||||
[172.7, 75.3], [182.2, 87.1], [164.1, 55.2], [163.0, 57.0],
|
|
||||||
[167.4, 67.7], [181.1, 66.0], [177.0, 68.2], [174.5, 63.9],
|
|
||||||
[177.5, 72.0], [170.5, 56.8], [182.4, 74.5], [197.1, 90.9],
|
|
||||||
[180.1, 93.0], [175.5, 80.9], [180.6, 72.7], [184.4, 68.0],
|
|
||||||
[175.5, 70.9], [180.6, 72.5], [177.0, 72.5], [177.1, 83.4],
|
|
||||||
[184.9, 86.4], [177.3, 73.2], [167.4, 53.9], [178.1, 72.0],
|
|
||||||
[168.9, 55.5], [157.2, 58.4], [180.3, 83.2], [170.2, 72.7],
|
|
||||||
[177.8, 64.1], [172.7, 72.3], [165.1, 65.0], [186.7, 86.4],
|
|
||||||
[165.1, 65.0], [174.0, 88.6], [175.3, 84.1], [185.4, 66.8],
|
|
||||||
[177.8, 75.5], [180.3, 93.2], [180.3, 82.7], [177.8, 58.0],
|
|
||||||
[163.8, 72.2], [188.0, 83.6], [198.1, 85.5], [175.3, 90.9],
|
|
||||||
[166.4, 85.9], [190.5, 89.1], [166.4, 75.0], [177.8, 77.7],
|
|
||||||
[179.7, 86.4], [172.7, 90.9], [190.5, 73.6], [185.4, 76.4],
|
|
||||||
[168.9, 69.1], [167.6, 84.5], [175.3, 64.5], [170.2, 69.1],
|
|
||||||
[171.4, 72.7], [172.7, 84.1], [172.7, 76.8], [177.8, 63.6],
|
|
||||||
[177.8, 80.9], [182.9, 80.9], [170.2, 85.5], [167.6, 68.6],
|
|
||||||
[172.7, 95.9], [190.5, 84.1], [179.1, 87.3], [175.3, 71.8],
|
|
||||||
[170.2, 65.9], [193.0, 95.9], [171.4, 91.4], [177.8, 81.8],
|
|
||||||
[177.8, 96.8], [167.6, 69.1], [167.6, 82.7], [180.3, 75.5]
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
|
Loading…
Reference in New Issue
Block a user