Fix for retrieving information about images without background

This commit is contained in:
l.gabrysiak 2025-03-24 15:48:45 +01:00
parent ce76cf5199
commit e9805da1f4
1 changed files with 4 additions and 10 deletions

View File

@ -65,30 +65,24 @@ namespace OSAFeedXML
bon_ec_name AS title,
bon_seo_description AS description,
CONCAT('{DomainRedirect}/produkt/', bon_slug_url, '--s-', bon_gid) AS link,
COALESCE(ic.bon_url, bn.bon_url) AS image_link,
CASE WHEN {WithoutBg} THEN ic.bon_url ELSE bn.bon_url END AS image_link,
CASE
WHEN bon_warehouse_state_central IS NULL OR bon_warehouse_state_central = 0 THEN 'out_of_stock'
WHEN NOT EXISTS (
SELECT 1
FROM UNNEST(bon_marketplace) AS marketplace_value
WHERE marketplace_value IN UNNEST([{string.Join(", ", Destinations.Select(dest => (int)dest))}])
)
OR bon_ecommerce_status NOT IN ({string.Join(", ", status.Select(stat => (int)stat))}) THEN 'out_of_stock'
) OR bon_ecommerce_status NOT IN ({string.Join(", ", status.Select(stat => (int)stat))}) THEN 'out_of_stock'
ELSE 'in_stock'
END AS availability,
ROUND(
bon_cash_price *
(CASE WHEN bon_price_for = {(int)PriceConversion.CONVERTION} THEN bon_converter ELSE 1 END) *
((100 + COALESCE(bon_vat_rate, 0)) / 100), 2
) AS price,
ROUND((bon_cash_price * (CASE WHEN bon_price_for = {(int)PriceConversion.CONVERTION} THEN bon_converter ELSE 1 END) * ((100 + bon_vat_rate) / 100)), 2) AS price,
bon_category_path AS product_type,
bon_name AS brand,
bon_ean AS gtin,
bon_index AS mpn,
osa_gmc_id AS google_product_category
FROM `{GoogleProjectId}.{GoogleDatabase}.bon_main_product` bn
LEFT JOIN `{GoogleProjectId}.{GoogleDatabase}.images_clearbg` ic
ON bn.bon_commodity_indexid = ic.bon_commodity_indexid
{ (WithoutBg ? $"JOIN `{GoogleProjectId}.{GoogleDatabase}.images_clearbg` ic ON bn.bon_commodity_indexid = ic.bon_commodity_indexid" : "JOIN (SELECT '1' AS bon_url) AS ic ON ic.bon_url = '1'") }
";
BigQueryResults results = bigqueryClient.ExecuteQuery(sql, null);