Skip to content

Commit

Permalink
Once again return getLatest as descending
Browse files Browse the repository at this point in the history
...we achieve the desired result when all the images where updated_at
is null is set to somewhere in the past, like this:

UPDATE images set updated_at = '2016-01-29 12:34:56.789+02' where updated_at is null;
  • Loading branch information
miro committed Feb 3, 2016
1 parent 9988256 commit c846871
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion controllers/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ controller.getLatest = function() {
return db.models.Image.forge()
.query('where', 'spotId', '<>', 0) // hack to achieve "not null"
.query('where', 'riderId', '<>', 0)
.query('orderBy', 'updated_at')
.query('orderBy', 'updated_at', 'desc')
.query('limit', AMOUNT_OF_PICS_TO_RETURN)
.fetchAll({ withRelated: [
'rider', 'photographer', 'spot', 'organisation'
Expand Down

0 comments on commit c846871

Please sign in to comment.