Finish hotfix-2

This commit is contained in:
nelsonlaquet 2013-09-09 21:25:56 -05:00
commit fe6807ac2e
6 changed files with 46 additions and 2 deletions

View file

@ -17,6 +17,7 @@
public function getIndex() {
$recentQuery = Track::summary()
->with(['genre', 'user', 'cover', 'user.avatar'])
->whereIsLatest(true)
->userDetails()
->explicitFilter()
->published()

View file

@ -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');
});
}
}

View file

@ -101,6 +101,9 @@
if ($track->published_at == null) {
$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'])) {

View file

@ -80,6 +80,9 @@
return $results;
});
if (!count($trackIds))
return [];
$tracks = Track::summary()
->userDetails()
->explicitFilter()

View file

@ -7249,7 +7249,7 @@ use Monolog\Formatter\LineFormatter;
abstract class AbstractHandler implements HandlerInterface
{
protected $level = Logger::DEBUG;
protected $bubble = false;
protected $bubble = true;
protected $formatter;
protected $processors = array();
public function __construct($level = Logger::DEBUG, $bubble = true)

View file

@ -49,7 +49,7 @@
</div>
</div>
<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">
Album:
<strong ng-show="selectedAlbum">{{selectedAlbum.title}}</strong>