mirror of
https://github.com/Hestia-Homes/survey-extraction.git
synced 2026-06-08 11:17:29 +00:00
commit
564a80dc05
3 changed files with 32 additions and 4 deletions
|
|
@ -1,7 +1,9 @@
|
|||
from etl.hubSpotClient.hubspotClient import HubSpotClient
|
||||
|
||||
def handler(event, context):
|
||||
hubspot = HubSpotClient()
|
||||
nums = [
|
||||
]
|
||||
|
||||
hubspot.add_product_line_item_to_deal("268596250843", "281058046195")
|
||||
|
||||
hubspot = HubSpotClient()
|
||||
for num in nums:
|
||||
hubspot.delete_line_item(num)
|
||||
|
|
@ -323,3 +323,19 @@ class HubSpotClient():
|
|||
self.associate_line_item_to_deal(line_item_id, deal_id)
|
||||
|
||||
return line_item_id
|
||||
|
||||
def delete_line_item(self, line_item_id: str):
|
||||
"""
|
||||
Delete (archive) a line item in HubSpot by its ID.
|
||||
"""
|
||||
try:
|
||||
self.logger.info(f"Deleting line item {line_item_id}...")
|
||||
|
||||
self.client.crm.line_items.basic_api.archive(line_item_id)
|
||||
|
||||
self.logger.info(f"Line item {line_item_id} deleted successfully.")
|
||||
return True
|
||||
|
||||
except ApiException as e:
|
||||
self.logger.error(f"Failed to delete line item {line_item_id}: {e}")
|
||||
return False
|
||||
|
|
@ -149,9 +149,19 @@ design4 = get_df(design4, "design upload to sharepoint", ["done"], "Design Repet
|
|||
if not design4.empty:
|
||||
filtered_dfs.append(design4)
|
||||
|
||||
all_filtered = pd.concat([df for df in (design1, design2, design3, design4) if not df.empty])
|
||||
dfs_to_concat = [df for df in (design1, design2, design3, design4) if not df.empty]
|
||||
|
||||
# Safe concat
|
||||
if dfs_to_concat:
|
||||
all_filtered = pd.concat(dfs_to_concat)
|
||||
else:
|
||||
all_filtered = pd.DataFrame() # empty df with no error
|
||||
|
||||
# Rows not matched by any design type
|
||||
design_remaining = design.loc[~design.index.isin(all_filtered.index)]
|
||||
|
||||
if not design_remaining.empty:
|
||||
design_remaining = design_remaining.copy()
|
||||
design_remaining["job_type"] = "design type not specified"
|
||||
filtered_dfs.append(design_remaining)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue