fix: properly find the most recent pop

Closes #2.
This commit is contained in:
insects 2025-03-31 23:38:45 +02:00
parent b21b6aa1a6
commit abbbf42715
2 changed files with 2 additions and 2 deletions

View file

@ -46,7 +46,7 @@
<div class="condition">
<% if nm[:is_popped] %>
<div class="pop-timer">
<% pop = instance.pops.find { |pop| pop.name == nm[:name].parameterize } %>
<% pop = instance.pops.find { |pop| (Time.now.utc - 120.minutes) <= pop.created_at and pop.name == nm[:name].parameterize } %>
<% mins = ActiveSupport::Duration.build(Time.current - pop.created_at) %>
<div class="timer">
<div>» <%= (120.minutes - mins).in_minutes.ceil %>m</div>