Explorar o código

Bugfix: counter.alreadyLiked wrong definition

Denis Merigoux %!s(int64=9) %!d(string=hai) anos
pai
achega
e7089321d6
Modificáronse 1 ficheiros con 1 adicións e 3 borrados
  1. 1 3
      counter/views/home.py

+ 1 - 3
counter/views/home.py

98
             # Computing the total number of likes for this counter
98
             # Computing the total number of likes for this counter
99
             likesMe = list(counter.lastReset.likes.all())
99
             likesMe = list(counter.lastReset.likes.all())
100
             counter.lastReset.likes_count = len(likesMe)
100
             counter.lastReset.likes_count = len(likesMe)
101
-            counter.alreadyLiked = myCounter in likesMe
101
+            counter.alreadyLiked = myCounter.id in [likeMe.liker.id for likeMe in likesMe]
102
             if counter.lastReset.likes_count > 0:
102
             if counter.lastReset.likes_count > 0:
103
                 counter.likersString = ", ".join([like.liker.trigramme for like in likesMe])
103
                 counter.likersString = ", ".join([like.liker.trigramme for like in likesMe])
104
             counter.lastReset.formatted_delta = arrow.Arrow.fromdatetime(counter.lastReset.timestamp).humanize(locale=get_language())
104
             counter.lastReset.formatted_delta = arrow.Arrow.fromdatetime(counter.lastReset.timestamp).humanize(locale=get_language())
321
     counter.sort_by_score = not counter.sort_by_score
321
     counter.sort_by_score = not counter.sort_by_score
322
     counter.save()
322
     counter.save()
323
     return HttpResponseRedirect(reverse('home'))
323
     return HttpResponseRedirect(reverse('home'))
324
-
325
-