diff --git a/headphones/api.py b/headphones/api.py index a8b97c02b..e38dce6e8 100644 --- a/headphones/api.py +++ b/headphones/api.py @@ -147,7 +147,7 @@ def _getAlbum(self, **kwargs): album = self._dic_from_query( 'SELECT * from albums WHERE AlbumID="' + self.id + '"') tracks = self._dic_from_query( - 'SELECT * from tracks WHERE AlbumID="' + self.id + '"') + 'SELECT * from tracks WHERE AlbumID="' + self.id + '" order by TrackNumber ASC') description = self._dic_from_query( 'SELECT * from descriptions WHERE ReleaseGroupID="' + self.id + '"') @@ -162,12 +162,12 @@ def _getHistory(self, **kwargs): def _getUpcoming(self, **kwargs): self.data = self._dic_from_query( - "SELECT * from albums WHERE ReleaseDate > date('now') order by ReleaseDate DESC") + "SELECT * from albums WHERE ReleaseDate > date('now') order by ReleaseDate ASC") return def _getWanted(self, **kwargs): self.data = self._dic_from_query( - "SELECT * from albums WHERE Status='Wanted'") + "SELECT * from albums WHERE Status='Wanted' and ReleaseDate <= date ('now') order by ReleaseDate DESC") return def _getSnatched(self, **kwargs): diff --git a/headphones/webserve.py b/headphones/webserve.py index 561dea0e3..ea740c3f4 100644 --- a/headphones/webserve.py +++ b/headphones/webserve.py @@ -531,7 +531,8 @@ def upcoming(self): myDB = db.DBConnection() upcoming = myDB.select( "SELECT * from albums WHERE ReleaseDate > date('now') order by ReleaseDate ASC") - wanted = myDB.select("SELECT * from albums WHERE Status='Wanted'") + wanted = myDB.select( + "SELECT * from albums WHERE Status='Wanted' and ReleaseDate <= date ('now') order by ReleaseDate DESC") return serve_template(templatename="upcoming.html", title="Upcoming", upcoming=upcoming, wanted=wanted)