Bugfix: Gesamtsumme der Stimmen auf /beliebt wieder korrekt. Auf Film-Seite, inaktive Nutzer gekennzeichnet.

This commit is contained in:
2016-05-20 05:39:35 +02:00
parent 372eadd0d9
commit d0b73e92ec
4 changed files with 7 additions and 7 deletions

View File

@@ -26,7 +26,7 @@ class Film extends Eloquent {
public function scopeMeistgewunschteVorschlage($query) {
$nextfilm = Dumbo::find(1)->film;
return $query
->addSelect(DB::raw('film_films.*, COUNT(case when film_votes.stimme IS TRUE then 1 end) as upvotes'))
->addSelect(DB::raw('film_films.*, COUNT(case when film_votes.stimme IS TRUE then 1 end) as upvotes, COUNT(*) as votes'))
->leftJoin('votes', 'votes.film', '=', 'films.id')
->leftJoin('users', 'users.id', '=', 'votes.user')
->whereNull('gesehen')
@@ -60,4 +60,4 @@ class Film extends Eloquent {
return $tmdb->getImageUrl($tmovie['poster_path'], TMDb::IMAGE_POSTER, 'w342');
}
}
}

View File

@@ -70,9 +70,9 @@ class User extends Eloquent implements UserInterface, RemindableInterface {
public function setSetting($key, $value) {
$settings = json_decode($this->settings);
if(is_null($settings)) {
$settings = array();
$settings = new stdClass();
}
$settings[$key] = $value;
$settings->$key = $value;
$this->settings = json_encode($settings);
}

View File

@@ -109,7 +109,7 @@
<dt>Daf&uuml;r</dt>
<dd>
@foreach($pv as $v)
<span class="badge">
<span class="badge" {{ $v->getSetting('disabled') ? 'style="color: #c77; font-style: italic;"' : '' }}>
<img class="img-circle" src="{{ $v->getAvatar() }}" width="20"> {{$v->name}}
</span>&nbsp;
@endforeach
@@ -118,7 +118,7 @@
<dt>Nicht daf&uuml;r</dt>
<dd>
@foreach($nv as $v)
<span class="badge">
<span class="badge" {{ $v->getSetting('disabled') ? 'style="color: #c77; font-style: italic"' : '' }}>
<img class="img-circle" src="{{ $v->getAvatar() }}" width="20"> {{$v->name}}
</span>&nbsp;
@endforeach

View File

@@ -27,7 +27,7 @@
$vp = $film->upvotes;
$np = $film->downvotes;
?>
<span class="glyphicon glyphicon-transfer"></span>&nbsp;{{ $vp + $np }}
<span class="glyphicon glyphicon-transfer"></span>&nbsp;{{ $np != null ? $vp + $np : $film->votes }}
</td>
<td>
@if(($vp) > 0) <span class="label label-default">+{{$vp}}</span>