bingo: "63 MW (design)" in datacenter page prose
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:
parent
f7ed3831f5
commit
a432a003a8
2 changed files with 10 additions and 1 deletions
|
|
@ -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]
|
||||
|
|
|
|||
|
|
@ -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"'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue