asxpio/db/migrations/016_bingo_provider.rb
Sergei Poljanski c64098813b
All checks were successful
Build and Deploy to Production / test (push) Successful in 27s
Build and Deploy to Production / build (push) Successful in 1m1s
Build and Deploy to Production / deploy (push) Successful in 38s
bingo: build the card from chosen providers
Let visitors tick providers (Yandex, IXcellerate, RTK-DC, Sber, …) and
get the usual 5×5 card made of only those providers' datacenters, first
25 in ranking order, with lines scored as normal. A selection with fewer
than 25 sites leaves the rest of the card empty, so the card is always
5×5. Each provider chip shows crossed/total for the current view.

Datacenters get a provider slug, backfilled from the free-text operator,
guessed for new rows and editable in the admin. Filtered URLs are
noindex with canonical to the plain card.

Assisted-by: Claude:opus-5
2026-10-11 21:12:47 +04:00

23 lines
1.1 KiB
Ruby
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Sequel.migration do
up do
# Company grouping for the per-provider cards (Bingo::PROVIDERS slugs).
# Backfilled from the free-text operator; Datacenter#before_create keeps
# new rows filled the same way (Bingo.guess_provider).
add_column :bingo_datacenters, :provider, String
{
'yandex' => %w[Яндекс%], 'ixcellerate' => %w[IXcellerate%], 'rtk' => %w[РТК-ЦОД%],
'atomdata' => %w[Атомдата% Росатом%], 'datapro' => %w[DataPro%], 'selectel' => %w[Selectel%],
'mws' => %w[MWS% МТС%], 'keypoint' => ['Key Point%'], '3data' => %w[3data%], 'sber' => %w[Сбер%],
'megafon' => %w[МегаФон%], 'datahouse' => %w[DataHouse%], 'oxygen' => %w[OXYGEN%], 'linx' => %w[Linx%],
'cloudx' => ['Cloud X%'], 'nkgroup' => ['NK Group%'], 'goznak' => %w[Гознак%]
}.each do |slug, patterns|
patterns.each do |pat|
self[:bingo_datacenters].where(provider: nil).where(Sequel.ilike(:operator, pat)).update(provider: slug)
end
end
end
down do
drop_column :bingo_datacenters, :provider
end
end