From 9e656ef3290bd47666bad38cf6b714f08bae8348 Mon Sep 17 00:00:00 2001 From: zman Date: Fri, 11 Apr 2025 11:33:03 -0400 Subject: [PATCH] this is a bug - apollo --- app/services/pricing.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/services/pricing.py b/app/services/pricing.py index 454d328..109e231 100644 --- a/app/services/pricing.py +++ b/app/services/pricing.py @@ -198,8 +198,13 @@ class PricingService: .all() } - # Map the ids using the dictionary - df['product_id'] = df['tcgplayer_id'].map(product_id_mapping) + # Map tcgplayer_id to product_id, ensure strings, keep None if not found + df['product_id'] = df['tcgplayer_id'].map(product_id_mapping).apply(lambda x: str(x) if pd.notnull(x) else None) + + # Log any tcgplayer_ids that didn't map to a product_id + null_product_ids = df[df['product_id'].isnull()]['tcgplayer_id'].tolist() + if null_product_ids: + logger.warning(f"The following tcgplayer_ids could not be mapped to a product_id: {null_product_ids}") price_lookup = self.get_all_prices_for_products(df['product_id'].unique())