mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-25 06:27:59 +01:00
T388: Albums, playlists, and artists are now sorted alphabetically; tracks have an alphabetical sort option; and a few new indices were added.
This commit is contained in:
parent
aa4350596e
commit
f7d128dbc5
5 changed files with 51 additions and 5 deletions
|
@ -75,7 +75,7 @@ class AlbumsController extends ApiControllerBase
|
|||
$query = Album::summary()
|
||||
->with('user', 'user.avatar', 'cover')
|
||||
->userDetails()
|
||||
->orderBy('created_at', 'desc')
|
||||
->orderBy('title', 'asc')
|
||||
->where('track_count', '>', 0);
|
||||
|
||||
$count = $query->count();
|
||||
|
@ -144,4 +144,4 @@ class AlbumsController extends ApiControllerBase
|
|||
'tracks' => $tracks
|
||||
], 200);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -167,7 +167,7 @@ class ArtistsController extends ApiControllerBase
|
|||
$page = Input::get('page');
|
||||
}
|
||||
|
||||
$query = User::orderBy('created_at', 'desc')
|
||||
$query = User::orderBy('display_name', 'asc')
|
||||
->where('track_count', '>', 0);
|
||||
|
||||
$count = $query->count();
|
||||
|
|
|
@ -46,7 +46,7 @@ class PlaylistsController extends ApiControllerBase
|
|||
$query = Playlist::summary()
|
||||
->with('user', 'user.avatar', 'tracks', 'tracks.cover', 'tracks.user', 'tracks.album', 'tracks.album.user')
|
||||
->userDetails()
|
||||
->orderBy('created_at', 'desc')
|
||||
->orderBy('title', 'asc')
|
||||
->where('track_count', '>', 0)
|
||||
->whereIsPublic(true);
|
||||
|
||||
|
@ -140,4 +140,4 @@ class PlaylistsController extends ApiControllerBase
|
|||
|
||||
return Response::json($playlists, 200);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AddAlphabeticalIndices extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->index('display_name');
|
||||
$table->index('track_count');
|
||||
});
|
||||
|
||||
Schema::table('playlists', function (Blueprint $table) {
|
||||
$table->index('title');
|
||||
$table->index('track_count');
|
||||
$table->index('is_public');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropIndex('users_display_name_index');
|
||||
$table->dropIndex('users_track_count_index');
|
||||
});
|
||||
|
||||
Schema::table('playlists', function (Blueprint $table) {
|
||||
$table->dropIndex('playlists_title_index');
|
||||
$table->dropIndex('playlists_track_count_index');
|
||||
$table->dropIndex('playlists_is_public_index');
|
||||
});
|
||||
}
|
||||
}
|
|
@ -184,6 +184,7 @@ angular.module('ponyfm').factory('tracks', [
|
|||
{title: 'Most Played', query: 'plays', isDefault: false, filter: 'order=play_count,desc'},
|
||||
{title: 'Most Downloaded', query: 'downloads', isDefault: false, filter: 'order=download_count,desc'},
|
||||
{title: 'Most Favourited', query: 'favourites', isDefault: false, filter: 'order=favourite_count,desc'}
|
||||
{title: 'Alphabetical', query: 'alphabetical', isDefault: false, filter: 'order=title,asc'},
|
||||
]
|
||||
|
||||
self.filters.genres =
|
||||
|
|
Loading…
Reference in a new issue