From 2a3fd1fdbe46426ffa9995f7c7d9ddc557d6c533 Mon Sep 17 00:00:00 2001 From: insects Date: Thu, 13 Mar 2025 14:49:34 +0100 Subject: [PATCH] feat: set a page title --- app/views/instance/_list.html.erb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/app/views/instance/_list.html.erb b/app/views/instance/_list.html.erb index d94a6e0..828131a 100644 --- a/app/views/instance/_list.html.erb +++ b/app/views/instance/_list.html.erb @@ -1,7 +1,11 @@
- <% APP_DATA[instance.zone.to_sym][:nms].each do |nm| %> - <% is_popped = instance.pops.filter { |pop| (Time.now.utc - 120.minutes) <= pop.created_at }.any? { |pop| pop.name == nm[:name].parameterize } %> -
+ <% nms_with_popped = APP_DATA[instance.zone.to_sym][:nms].map {|nm| + is_popped = instance.pops.filter { |pop| (Time.now.utc - 120.minutes) <= pop.created_at }.any? { |pop| pop.name == nm[:name].parameterize } + { is_popped: is_popped, **nm } + } %> + <% content_for :title, "#{instance.zone}, #{nms_with_popped.filter { |n| !n[:is_popped] && !has_missing_reqs?(n, forecast) }.count} NMs avail. | eureka.coffee" %> + <% nms_with_popped.each do |nm| %> +
" alt="<%= nm[:element] %>" width="30" />
@@ -29,7 +33,7 @@
- <% if is_popped %> + <% if nm[:is_popped] %>
<% pop = instance.pops.find { |pop| pop.name == nm[:name].parameterize } %> <% mins = ActiveSupport::Duration.build(Time.current - pop.created_at) %> @@ -50,7 +54,7 @@
<% end %>
- <% if is_popped && has_missing_reqs?(nm, forecast) %> + <% if nm[:is_popped] && has_missing_reqs?(nm, forecast) %> ยป <% end %> <% if nm[:weather] && forecast[0][:curr_weather] != nm[:weather] %> @@ -67,7 +71,7 @@
- <% if is_popped %> + <% if nm[:is_popped] %>