mirror of
https://github.com/Hestia-Homes/Model.git
synced 2026-06-08 11:17:27 +00:00
be the same as main
This commit is contained in:
parent
98c9a1df74
commit
ef366f1cd5
1 changed files with 11 additions and 9 deletions
|
|
@ -140,8 +140,16 @@ def handler(
|
|||
body_dict = {
|
||||
"task_id": "test",
|
||||
"subtask_id": "test",
|
||||
"portfolio_id": 670,
|
||||
"scenario_ids": [1199],
|
||||
"portfolio_id": 655,
|
||||
"scenario_ids": [],
|
||||
"default_plans_only": True,
|
||||
}
|
||||
|
||||
body_dict = {
|
||||
"task_id": "test",
|
||||
"subtask_id": "test",
|
||||
"portfolio_id": 655,
|
||||
"scenario_ids": [1174],
|
||||
"default_plans_only": False,
|
||||
}
|
||||
:param event: Lambda event containing export request details
|
||||
|
|
@ -165,14 +173,8 @@ def handler(
|
|||
with db_read_session() as session:
|
||||
exported_files = process_export(payload, session)
|
||||
|
||||
output_path = f"/tmp/export_{payload.portfolio_id}.xlsx"
|
||||
with pd.ExcelWriter(output_path, engine="openpyxl") as writer:
|
||||
for group_key, df in exported_files.items():
|
||||
sheet_name = str(group_key)[:31] # Excel sheet name limit
|
||||
df.to_excel(writer, sheet_name=sheet_name, index=False)
|
||||
|
||||
logger.info("Exported to %s", output_path)
|
||||
# TODO: Need to handle the exported files - e.g. upload to s3 and email a presigned url
|
||||
_ = exported_files
|
||||
return {
|
||||
"statusCode": 200,
|
||||
"body": json.dumps({}),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue