Skip to content

Commit

Permalink
Change when files are committed
Browse files Browse the repository at this point in the history
  • Loading branch information
aanil committed May 28, 2024
1 parent 1178350 commit 25d23e2
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions daily_read/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,20 +100,18 @@ def generate_all(ctx, upload=False, develop=False):
for upload_category, report_state in {"projects": "published", "delete_report_for": "review"}.items():
for status in modified_orders[owner][upload_category].keys():
for project in modified_orders[owner][upload_category][status]:
uploaded = False
request_success = False
report_upload = report if upload_category == "projects" else ""
try:
uploaded = op.upload_report_to_order_portal(report_upload, project, report_state)
# Stage changes only if report was uploaded
if uploaded:
request_success = op.upload_report_to_order_portal(report_upload, project, report_state)
# Stage changes
if request_success:
op.projects_data.stage_data_for_project(project)
# catch any and every exception during upload
except Exception as e:
log.error(
f"Exception Raised: Issue in uploading/hiding reports for {project.project_id}: {e}\nContinuing to next project"
)
# Commit all uploaded projects
op.projects_data.commit_staged_data(f"Commit reports updates for {datetime.datetime.now()}")

else:
log.info("Saving report to disk instead of uploading")
Expand All @@ -123,6 +121,10 @@ def generate_all(ctx, upload=False, develop=False):
config_values.STATUS_PRIORITY,
out_dir=config_values.REPORTS_LOCATION,
)
if upload:
# Commit all uploaded projects
op.projects_data.commit_staged_data(f"Commit reports updates for {datetime.datetime.now()}")

daily_read.utils.error_reporting(log)


Expand Down

0 comments on commit 25d23e2

Please sign in to comment.