mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
minimum count as parameter
This commit is contained in:
@@ -136,7 +136,7 @@ public class FeedDAO extends GenericDAO<Feed> {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<FeedCount> findDuplicates(int offset, int limit) {
|
public List<FeedCount> findDuplicates(int offset, int limit, long minCount) {
|
||||||
CriteriaQuery<String> query = builder.createQuery(String.class);
|
CriteriaQuery<String> query = builder.createQuery(String.class);
|
||||||
Root<Feed> root = query.from(getType());
|
Root<Feed> root = query.from(getType());
|
||||||
|
|
||||||
@@ -146,7 +146,7 @@ public class FeedDAO extends GenericDAO<Feed> {
|
|||||||
query.select(hashPath);
|
query.select(hashPath);
|
||||||
|
|
||||||
query.groupBy(hashPath);
|
query.groupBy(hashPath);
|
||||||
query.having(builder.greaterThan(count, 1l));
|
query.having(builder.greaterThan(count, minCount));
|
||||||
|
|
||||||
TypedQuery<String> q = em.createQuery(query);
|
TypedQuery<String> q = em.createQuery(query);
|
||||||
limit(q, offset, limit);
|
limit(q, offset, limit);
|
||||||
|
|||||||
@@ -273,8 +273,8 @@ public class AdminREST extends AbstractResourceREST {
|
|||||||
@GET
|
@GET
|
||||||
@ApiOperation(value = "Find duplicate feeds")
|
@ApiOperation(value = "Find duplicate feeds")
|
||||||
public Response findDuplicateFeeds(@QueryParam("page") int page,
|
public Response findDuplicateFeeds(@QueryParam("page") int page,
|
||||||
@QueryParam("limit") int limit) {
|
@QueryParam("limit") int limit, @QueryParam("minCount") long minCount) {
|
||||||
List<FeedCount> list = feedDAO.findDuplicates(limit * page, limit);
|
List<FeedCount> list = feedDAO.findDuplicates(limit * page, limit, minCount);
|
||||||
return Response.ok(list).build();
|
return Response.ok(list).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -294,7 +294,7 @@ public class AdminREST extends AbstractResourceREST {
|
|||||||
Feed feed = feedDAO.findById(feedId);
|
Feed feed = feedDAO.findById(feedId);
|
||||||
feeds.add(feed);
|
feeds.add(feed);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (feeds.isEmpty()) {
|
if (feeds.isEmpty()) {
|
||||||
return Response.status(Status.BAD_REQUEST)
|
return Response.status(Status.BAD_REQUEST)
|
||||||
.entity("'from feeds' empty").build();
|
.entity("'from feeds' empty").build();
|
||||||
|
|||||||
@@ -1210,11 +1210,13 @@ module.controller('ManageDuplicateFeedsCtrl', [
|
|||||||
|
|
||||||
$scope.limit = 10;
|
$scope.limit = 10;
|
||||||
$scope.page = 0;
|
$scope.page = 0;
|
||||||
|
$scope.minCount = 1;
|
||||||
$scope.mergeData = {};
|
$scope.mergeData = {};
|
||||||
$scope.refreshData = function() {
|
$scope.refreshData = function() {
|
||||||
AdminCleanupService.findDuplicateFeeds({
|
AdminCleanupService.findDuplicateFeeds({
|
||||||
limit : $scope.limit,
|
limit : $scope.limit,
|
||||||
page : $scope.page
|
page : $scope.page,
|
||||||
|
minCount: $scope.minCount
|
||||||
}, function(data) {
|
}, function(data) {
|
||||||
$scope.counts = data;
|
$scope.counts = data;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
Limit <input type="number" ng-model="limit" />
|
Limit <input type="number" ng-model="limit" />
|
||||||
Page <input type="number" ng-model="page" />
|
Page <input type="number" ng-model="page" />
|
||||||
|
Min. count <input type="number" ng-model="minCount" />
|
||||||
<input type="button" class="btn" ng-click="refreshData()" value="Refresh" />
|
<input type="button" class="btn" ng-click="refreshData()" value="Refresh" />
|
||||||
<table class="table table-condensed table-hover" ui-if="counts">
|
<table class="table table-condensed table-hover" ui-if="counts">
|
||||||
<thead>
|
<thead>
|
||||||
|
|||||||
Reference in New Issue
Block a user