fix query
This commit is contained in:
parent
4ae01bb3f1
commit
691ea95a1c
@ -20,7 +20,7 @@ import ru.ulstu.extractor.model.Repository;
|
||||
import java.util.List;
|
||||
|
||||
public interface CommitRepository extends JpaRepository<Commit, Integer> {
|
||||
@Query("SELECT DISTINCT c FROM Commit c JOIN c.branch b JOIN c.fileChanges f JOIN c.author a JOIN b.repository r WHERE r = :repository AND b.name = :branchName AND (:author IS NULL OR :author = '' OR a.name = :author) AND (:filter IS NULL OR :filter = '' OR lower(c.message) LIKE lower(concat('%', :filter,'%'))) AND (:entity IS NULL OR f.containsEntity = :entity)")
|
||||
@Query("SELECT DISTINCT c FROM Commit c LEFT JOIN c.branch b LEFT JOIN c.fileChanges f LEFT JOIN c.author a LEFT JOIN b.repository r WHERE r = :repository AND b.name = :branchName AND (:author IS NULL OR :author = '' OR a.name = :author) AND (:filter IS NULL OR :filter = '' OR lower(c.message) LIKE lower(concat('%', :filter,'%'))) AND (:entity IS NULL OR f.containsEntity = :entity)")
|
||||
Page<Commit> findByRepositoryAndBranch(Pageable pageable, @Param("repository") Repository repository, @Param("branchName") String branchName, @Param("author") String author, @Param("filter") String filter, @Param("entity") Boolean entity);
|
||||
|
||||
@Query("SELECT new ru.ulstu.extractor.model.CommitAuthorStatistic(c.author.name, COUNT(DISTINCT c.hash)) FROM Commit c GROUP by c.author.name")
|
||||
|
@ -112,9 +112,8 @@ public class GitRepositoryService {
|
||||
List<Commit> list = new ArrayList<>();
|
||||
RevCommit prevCommit = null;
|
||||
LOG.debug("Start analyse {} commits", commits.size());
|
||||
commitsFrom = commitsFrom > commits.size() ? commits.size() - 1 : commitsFrom;
|
||||
commitsFrom = Math.max(commitsFrom, 0);
|
||||
commitsTo = commitsTo > commits.size() ? commits.size() - 1 : commitsTo;
|
||||
commitsTo = Math.min(commitsTo, commits.size());
|
||||
commitsTo = Math.max(commitsTo, 0);
|
||||
for (int i = commitsFrom; i < commitsTo; i++) {
|
||||
RevCommit revCommit = commits.get(i);
|
||||
|
@ -58,5 +58,6 @@ public class IndexService {
|
||||
commitsTo += COMMITS_PAGE_SIZE;
|
||||
commits = gitRepositoryService.getCommits(repositoryUrl, branchName, commitsFrom, commitsTo, false);
|
||||
}
|
||||
LOG.debug("Complete indexing {} branch", branchName);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user