Bläddra i källkod

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

Daniel 8 år sedan
förälder
incheckning
d0b73e92ec
4 ändrade filer med 7 tillägg och 7 borttagningar
  1. 2 2
      app/models/Film.php
  2. 2 2
      app/models/User.php
  3. 2 2
      app/views/film.blade.php
  4. 1 1
      app/views/suggest.blade.php

+ 2 - 2
app/models/Film.php

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

+ 2 - 2
app/models/User.php

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

+ 2 - 2
app/views/film.blade.php

@@ -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

+ 1 - 1
app/views/suggest.blade.php

@@ -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>