diff --git a/app/services/pricing.py b/app/services/pricing.py index 52412a0..72d4911 100644 --- a/app/services/pricing.py +++ b/app/services/pricing.py @@ -299,8 +299,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())