I have a problem with the results of my orderby getting. You can see the problem here.
The listing is ok, the result is showing an order by hour. But the problem is on the final result, a trouble white space.
This is the code of my results html :
<h2>PRONOSTICS DU JOUR</h2>
<div class="row mediaItemCtr" ng-repeat="mi in mediaItems">
<media-item></media-item>
</div>
And this is the code of getting results:
$searchQuery = "SELECT *,(
SELECT `display_name` FROM users WHERE id=m.uid
) as `display_name`,(
SELECT `username` FROM users WHERE id=m.uid
) as `username`, (
SELECT COUNT(*) FROM media_likes WHERE mid=m.id AND sid = :sid
) as `isPurple` FROM media m WHERE status='1' ORDER BY `hour` ASC
LIMIT " . $offset . ", " . $settings['display_count'];`
And the js :
rocketeerApp.controller("homeController", ["$scope", "$http", "$timeout", function($scope, $http, $timeout){
$scope.mediaItems = [];
$scope.search = {
offset: 0
};
$scope.slides = slides;
$scope.isGrabbing = false;
$scope.stopGrabbing = false;
$scope.getMediaItems = function(){
if($scope.isGrabbing || $scope.stopGrabbing){
return null;
}
$scope.isGrabbing = true;
$http({
method: 'POST',
url: 'actions/get-home-media-items.php',
data: $scope.search
}).success(function(data,status,headers,config){
data.items.forEach(function(ele,ind,arr){
$scope.mediaItems.push(ele);
});
$scope.search.offset = $scope.mediaItems.length;
$scope.isGrabbing = false;
if(data.items.length === 0){
$scope.stopGrabbing = true;
}
});
};
$scope.getMediaItems();
$( document).scroll(function() {
var checkPoint = $(document).height() - 1000;
if($(document).scrollTop() > checkPoint ){
$scope.getMediaItems();
}
});
}]);