From a432a003a8398c819c0df4e83f29d4a82df5a963 Mon Sep 17 00:00:00 2001 From: Sergei Poljanski Date: Sat, 10 Oct 2026 09:45:49 +0400 Subject: [PATCH] bingo: "63 MW (design)" in datacenter page prose MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The facts sentence reused the dialog's compact label, so it read "Capacity: 63 MW · design." Put the capacity type in parentheses when it appears in prose. Assisted-by: Claude:opus-5 --- bingo_web.rb | 8 +++++++- test/bingo_test.rb | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/bingo_web.rb b/bingo_web.rb index e5701da..7aecebc 100644 --- a/bingo_web.rb +++ b/bingo_web.rb @@ -86,7 +86,7 @@ class BingoWeb < Sinatra::Base # Plain-language facts for the datacenter page and its meta description. def dc_facts(dc) [format(t(:dc_intro), name: dc.l(:name, @locale), city: dc.l(:city, @locale), operator: dc.operator), - (format(t(:dc_capacity), mw: mw(dc)) if mw(dc)), + (format(t(:dc_capacity), mw: mw_prose(dc)) if mw(dc)), { 'building' => t(:dc_building), 'planned' => t(:dc_planned) }[dc.status] || (dc.year && format(t(:dc_since), dc.year)), format(t(:dc_rank), pos: dc.position)].compact end @@ -115,6 +115,12 @@ class BingoWeb < Sinatra::Base ["#{dc.mw} #{t(:mw)}", tag || nil].compact.join(' · ') end + # "63 MW (design)": the dialog's " · design" tag reads badly in a sentence. + def mw_prose(dc) + tag = dc.mw_type != 'mva' && t(:mw_types)[dc.mw_type] + tag ? "#{mw(dc, tag: false)} (#{tag})" : mw(dc) + end + # Badge for anything not yet in service. def status_label(dc) { 'building' => t(:building), 'planned' => t(:planned) }[dc.status] diff --git a/test/bingo_test.rb b/test/bingo_test.rb index 07cb36f..6aa2941 100644 --- a/test/bingo_test.rb +++ b/test/bingo_test.rb @@ -248,6 +248,9 @@ class BingoTest < Minitest::Test crumbs = ld['@graph'].find { |n| n['@type'] == 'BreadcrumbList' } assert_equal 'https://example.org/en', crumbs['itemListElement'][0]['item'] + @dcs[3].update(mw_type: 'design') + get '/en/dc/dc-4' + assert_includes last_response.body, 'Capacity: 4 MW (design).' get '/uk/dc/dc-1' assert_includes last_response.body, 'ЦОД 1 (Москва) — інциденти ЦОДу | Бінго ЦОДів' refute_includes last_response.body, 'rel="prev"'