Fix video indexing

This commit is contained in:
Omar Roth 2018-02-04 19:42:13 -06:00
parent 1facca5408
commit d79c1ff3e9
2 changed files with 24 additions and 9 deletions

View file

@ -182,7 +182,11 @@ get "/watch" do |env|
rating = video.info["avg_rating"].to_f64
engagement = ((video.dislikes.to_f + video.likes.to_f)/video.views * 100)
if video.likes > 0 || video.dislikes > 0
calculated_rating = (video.likes.to_f/(video.likes.to_f + video.dislikes.to_f) * 4 + 1)
else
calculated_rating = 0.0
end
templated "watch"
end