mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-22 21:18:00 +01:00
Added in is_latest feature
This commit is contained in:
parent
43fbd56565
commit
353c3a4f11
6 changed files with 46 additions and 2 deletions
|
@ -17,6 +17,7 @@
|
||||||
public function getIndex() {
|
public function getIndex() {
|
||||||
$recentQuery = Track::summary()
|
$recentQuery = Track::summary()
|
||||||
->with(['genre', 'user', 'cover', 'user.avatar'])
|
->with(['genre', 'user', 'cover', 'user.avatar'])
|
||||||
|
->whereIsLatest(true)
|
||||||
->userDetails()
|
->userDetails()
|
||||||
->explicitFilter()
|
->explicitFilter()
|
||||||
->published()
|
->published()
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class CreateLatestColumn extends Migration {
|
||||||
|
public function up() {
|
||||||
|
Schema::table('tracks', function($table) {
|
||||||
|
$table->boolean('is_latest')->notNullable()->indexed();
|
||||||
|
});
|
||||||
|
|
||||||
|
DB::update('
|
||||||
|
UPDATE
|
||||||
|
tracks
|
||||||
|
SET
|
||||||
|
is_latest = true
|
||||||
|
WHERE
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
t2.id
|
||||||
|
FROM
|
||||||
|
(SELECT id, user_id FROM tracks WHERE published_at IS NOT NULL AND deleted_at IS NULL) AS t2
|
||||||
|
WHERE
|
||||||
|
t2.user_id = tracks.user_id
|
||||||
|
ORDER BY
|
||||||
|
created_at DESC
|
||||||
|
LIMIT 1
|
||||||
|
) = tracks.id
|
||||||
|
AND
|
||||||
|
published_at IS NOT NULL');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down() {
|
||||||
|
Schema::table('tracks', function($table) {
|
||||||
|
$table->dropColumn('is_latest');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -101,6 +101,9 @@
|
||||||
|
|
||||||
if ($track->published_at == null) {
|
if ($track->published_at == null) {
|
||||||
$track->published_at = new \DateTime();
|
$track->published_at = new \DateTime();
|
||||||
|
|
||||||
|
DB::table('tracks')->whereUserId($track->user_id)->update(['is_latest' => false]);
|
||||||
|
$track->is_latest = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($this->_input['cover_id'])) {
|
if (isset($this->_input['cover_id'])) {
|
||||||
|
|
|
@ -80,6 +80,9 @@
|
||||||
return $results;
|
return $results;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!count($trackIds))
|
||||||
|
return [];
|
||||||
|
|
||||||
$tracks = Track::summary()
|
$tracks = Track::summary()
|
||||||
->userDetails()
|
->userDetails()
|
||||||
->explicitFilter()
|
->explicitFilter()
|
||||||
|
|
|
@ -7249,7 +7249,7 @@ use Monolog\Formatter\LineFormatter;
|
||||||
abstract class AbstractHandler implements HandlerInterface
|
abstract class AbstractHandler implements HandlerInterface
|
||||||
{
|
{
|
||||||
protected $level = Logger::DEBUG;
|
protected $level = Logger::DEBUG;
|
||||||
protected $bubble = false;
|
protected $bubble = true;
|
||||||
protected $formatter;
|
protected $formatter;
|
||||||
protected $processors = array();
|
protected $processors = array();
|
||||||
public function __construct($level = Logger::DEBUG, $bubble = true)
|
public function __construct($level = Logger::DEBUG, $bubble = true)
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row-fluid">
|
<div class="row-fluid">
|
||||||
<div class="form-row album span6" ng-class="{'has-error': errors.show_song_ids != null}">
|
<div class="form-row album span6" ng-class="{'has-error': errors.album_id != null}">
|
||||||
<a pfm-popup="album-selector" href="#" class="btn btn-small">
|
<a pfm-popup="album-selector" href="#" class="btn btn-small">
|
||||||
Album:
|
Album:
|
||||||
<strong ng-show="selectedAlbum">{{selectedAlbum.title}}</strong>
|
<strong ng-show="selectedAlbum">{{selectedAlbum.title}}</strong>
|
||||||
|
|
Loading…
Reference in a new issue