Skip to content

Commit

Permalink
Merge pull request #7 from BranHill21/debugging_cov
Browse files Browse the repository at this point in the history
fixing deployed homepage error
  • Loading branch information
BranHill21 authored Dec 6, 2024
2 parents 4ef36ac + f70e337 commit 74b1afb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/views/layout/_homepage.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,13 @@
<% @all_galleries = Gallery.all %>
<% map = {} %>
<% @all_galleries.each do |gal| %>
<% total = gal.reviews.sum(&:rating).to_i %>
<% count = gal.reviews.size %>
<% total = gal.reviews.sum(&:rating).to_i if gal.reviews.present? %>
<% total ||= 0 %>
<% count = gal.reviews.size if gal.reviews.present? %>
<% count ||= 0 %>
<% gal.gallery_totalRate ||= total %>
<% gal.gallery_totalRator ||= count %>
<% if map.size < 50 && (gal.gallery_totalRate / gal.gallery_totalRator >= 3) %>
<% if map.size < 50 && gal.gallery_totalRator > 0 && (gal.gallery_totalRate / gal.gallery_totalRator >= 3) %>
<% map[gal] = gal.gallery_totalRate / gal.gallery_totalRator %>
<% end %>
<% end %>
Expand Down

0 comments on commit 74b1afb

Please sign in to comment.