#19 -- Fix case sensitivity filtering
This commit is contained in:
parent
d69c4ea5f5
commit
e58e2be281
@ -40,7 +40,8 @@ public class GitFilteringController {
|
||||
@RequestParam Optional<Integer> size,
|
||||
@RequestParam Optional<String> repositoryUrl,
|
||||
@RequestParam Optional<String> branchName,
|
||||
@RequestParam Optional<String> author) {
|
||||
@RequestParam Optional<String> author,
|
||||
@RequestParam Optional<String> filter) {
|
||||
int currentPage = page.orElse(1);
|
||||
int pageSize = size.orElse(DEFAULT_PAGE_SIZE);
|
||||
|
||||
@ -50,6 +51,7 @@ public class GitFilteringController {
|
||||
Page<Commit> commitsPage = filteringService.getCommits(notEmptyRepositoryUrl,
|
||||
notEmptyBranchName,
|
||||
author.orElse(null),
|
||||
filter.orElse(null),
|
||||
new OffsetablePageRequest(currentPage - 1, pageSize));
|
||||
int totalPages = commitsPage.getTotalPages();
|
||||
if (totalPages > 0) {
|
||||
@ -63,6 +65,7 @@ public class GitFilteringController {
|
||||
filterForm.setBranchName(notEmptyBranchName);
|
||||
filterForm.setRepositoryUrl(notEmptyRepositoryUrl);
|
||||
filterForm.setAuthor(author.orElse(null));
|
||||
filterForm.setFilter(filter.orElse(null));
|
||||
model.addAttribute("filterForm", filterForm);
|
||||
model.addAttribute("authors", filteringService.getRepositoryAuthors(
|
||||
notEmptyRepositoryUrl,
|
||||
|
@ -19,7 +19,7 @@ import ru.ulstu.extractor.model.Repository;
|
||||
import java.util.List;
|
||||
|
||||
public interface CommitRepository extends JpaRepository<Commit, Integer> {
|
||||
@Query("SELECT c FROM Commit c, Repository r, Branch b, Author a WHERE c.branch = b AND r = b.repository AND a = c.author AND r = :repository AND b.name = :branchName AND (:author IS NULL OR :author = '' OR a.name = :author) AND c.message LIKE %:filter%")
|
||||
@Query("SELECT c FROM Commit c, Repository r, Branch b, Author a WHERE c.branch = b AND r = b.repository AND a = c.author AND 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,'%')))")
|
||||
Page<Commit> findByRepositoryAndBranch(Pageable pageable, @Param("repository") Repository repository, @Param("branchName") String branchName, @Param("author") String author, @Param("filter") String filter);
|
||||
|
||||
@Query("SELECT new ru.ulstu.extractor.model.CommitAuthorStatistic(c.author.name, COUNT(DISTINCT c.hash)) FROM Commit c GROUP by c.author.name")
|
||||
|
@ -34,6 +34,7 @@
|
||||
<div class="col-md-3 col-sm-12">
|
||||
<select id="select-author" class="selectpicker" data-live-search="true" th:field="*{author}"
|
||||
data-width="90%">
|
||||
<option value="">Все авторы</option>
|
||||
<option th:each="author : ${authors}"
|
||||
th:value="${author}"
|
||||
th:utext="${author}">
|
||||
|
Loading…
Reference in New Issue
Block a user