0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-22 09:20:29 +01:00

Minor tweaks to subscription loading logic

Dieser Commit ist enthalten in:
Angus McLeod 2023-05-04 17:16:11 +02:00
Ursprung 99f2e8bbd9
Commit 42517c094e

Datei anzeigen

@ -109,20 +109,19 @@ class CustomWizard::Subscription
result = SubscriptionClient.find_subscriptions("discourse-custom-wizard") result = SubscriptionClient.find_subscriptions("discourse-custom-wizard")
if result&.any? if result&.any?
slugs = result.supplier.product_slugs ids_and_slugs = result.subscriptions.map do |subscription|
{
if slugs.present? id: subscription.product_id,
ids_and_slugs = result.subscriptions.map do |subscription| slug: result.products[subscription.product_id]
{ id: subscription.product_id, slug: slugs[subscription.product_id] } }
end
id_and_slug = ids_and_slugs.sort do |a, b|
PRODUCT_HIERARCHY[a[:slug]] - PRODUCT_HIERARCHY[b[:slug]]
end.first
@product_id = id_and_slug[:id]
@product_slug = id_and_slug[:slug]
end end
id_and_slug = ids_and_slugs.sort do |a, b|
PRODUCT_HIERARCHY[a[:slug]] - PRODUCT_HIERARCHY[b[:slug]]
end.first
@product_id = id_and_slug[:id]
@product_slug = id_and_slug[:slug]
end end
end end
end end