Skip to content

Commit

Permalink
Fix hackathon events N+1
Browse files Browse the repository at this point in the history
  • Loading branch information
northeastprince authored Nov 8, 2023
1 parent 65d9688 commit a42dd83
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/models/hackathon/website/archivable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ def website_or_archive_url
end

def website_archived?
events.where(action: "archived_website").exists?
if events.loaded?
events.any? {|e| e.action == "archived_website"}
else
events.where(action: "archived_website").exists?
end
end

def eligible_for_archive?
Expand Down

0 comments on commit a42dd83

Please sign in to comment.