bingo: "63 MW (design)" in datacenter page prose
All checks were successful
Build and Deploy to Production / test (push) Successful in 26s
Build and Deploy to Production / build (push) Successful in 1m3s
Build and Deploy to Production / deploy (push) Successful in 39s

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
This commit is contained in:
Sergei Poljanski 2026-10-10 09:45:49 +04:00
commit a432a003a8
Signed by: asxpi
GPG key ID: 4F8851660FA4121B
2 changed files with 10 additions and 1 deletions

View file

@ -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]

View file

@ -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, '<title>ЦОД 1 (Москва) — інциденти ЦОДу | Бінго ЦОДів</title>'
refute_includes last_response.body, 'rel="prev"'