[2ff88f42] Implement Ops-Secondary Logic & Matrix Gen v3.2
This commit is contained in:
@@ -67,6 +67,7 @@ def extract_select(prop):
|
||||
return prop.get("select", {}).get("name", "") if prop.get("select") else ""
|
||||
|
||||
def extract_number(prop):
|
||||
if not prop: return None
|
||||
return prop.get("number")
|
||||
|
||||
def sync_categories(token, session):
|
||||
@@ -135,6 +136,11 @@ def sync_industries(token, session):
|
||||
industry.name = name
|
||||
industry.description = extract_rich_text(props.get("Definition"))
|
||||
|
||||
# New: Map Pains & Gains explicitly
|
||||
industry.pains = extract_rich_text(props.get("Pains"))
|
||||
industry.gains = extract_rich_text(props.get("Gains"))
|
||||
industry.notes = extract_rich_text(props.get("Notes"))
|
||||
|
||||
status = extract_select(props.get("Status"))
|
||||
industry.status_notion = status
|
||||
industry.is_focus = (status == "P1 Focus Industry")
|
||||
@@ -147,6 +153,9 @@ def sync_industries(token, session):
|
||||
industry.scraper_search_term = extract_select(props.get("Scraper Search Term")) # <-- FIXED HERE
|
||||
industry.scraper_keywords = extract_rich_text(props.get("Scraper Keywords"))
|
||||
industry.standardization_logic = extract_rich_text(props.get("Standardization Logic"))
|
||||
|
||||
# New Field: Ops Focus Secondary (Checkbox)
|
||||
industry.ops_focus_secondary = props.get("Ops Focus: Secondary", {}).get("checkbox", False)
|
||||
|
||||
# Relation: Primary Product Category
|
||||
relation = props.get("Primary Product Category", {}).get("relation", [])
|
||||
@@ -157,6 +166,16 @@ def sync_industries(token, session):
|
||||
industry.primary_category_id = cat.id
|
||||
else:
|
||||
logger.warning(f"Related category {related_id} not found for industry {name}")
|
||||
|
||||
# Relation: Secondary Product Category
|
||||
relation_sec = props.get("Secondary Product", {}).get("relation", [])
|
||||
if relation_sec:
|
||||
related_id = relation_sec[0]["id"]
|
||||
cat = session.query(RoboticsCategory).filter(RoboticsCategory.notion_id == related_id).first()
|
||||
if cat:
|
||||
industry.secondary_category_id = cat.id
|
||||
else:
|
||||
logger.warning(f"Related Secondary category {related_id} not found for industry {name}")
|
||||
|
||||
count += 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user