Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter None from report, catch all possible exceptions during upload and do not stage the project #34

Merged
merged 5 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions daily_read/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,20 @@ def generate_all(upload=False, develop=False):
for owner in modified_orders:
if upload:
report = daily_rep.populate_and_write_report(owner, modified_orders[owner], config_values.STATUS_PRIORITY)
# Publish reports
for status in modified_orders[owner]["projects"].keys():
for project in modified_orders[owner]["projects"][status]:
uploaded = False
uploaded = op.upload_report_to_order_portal(report, project, "published")
if uploaded:
op.projects_data.stage_data_for_project(project)
# Hide old reports
for status in modified_orders[owner]["delete_report_for"].keys():
for project in modified_orders[owner]["delete_report_for"][status]:
uploaded = False
uploaded = op.upload_report_to_order_portal("", project, "review")
if uploaded:
op.projects_data.stage_data_for_project(project)
# Publish reports with published, hide reports with review
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
report_upload = report if upload_category == "projects" else ""
try:
uploaded = op.upload_report_to_order_portal(report_upload, project, report_state)
aanil marked this conversation as resolved.
Show resolved Hide resolved
# Stage changes only if report was uploaded
if uploaded:
op.projects_data.stage_data_for_project(project)
# catch any and every exception during upload
except Exception as e:
log.error(f"Theres was an issue in uploading/hiding reports for {project.project_id}: {e}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe make this error message more threatening. "Exception raised" and "Still continuing with other reports" and similar phrases could be used.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made it a bit more threatening 😄

# Commit all uploaded projects
op.projects_data.commit_staged_data(f"Commit reports updates for {datetime.datetime.now()}")

Expand Down
16 changes: 6 additions & 10 deletions daily_read/templates/daily_report.html.j2
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<!DOCTYPE html>
<html lang="en">
<iframe
id="ngi_progress_report"
srcdoc='
<iframe id="ngi_progress_report" srcdoc='
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
Expand Down Expand Up @@ -155,6 +153,7 @@
{% else %}
<div id="projects_list">
{% for date_prio, date_type in priority | dictsort %}
{% if date_type != "None"%}
<div class="row p-3">
<div
class="col-sm border-end border-primary me-3 d-flex align-items-center"
Expand Down Expand Up @@ -214,6 +213,7 @@
{% endfor %}
</div>
</div>
{% endif %}
{% endfor %}
</div>
{% endif %}
Expand All @@ -232,10 +232,6 @@
const tooltipList = [...tooltipTriggerList].map(tooltipTriggerEl => new bootstrap.Tooltip(tooltipTriggerEl));
</script>
</body>
'
width="120%"
height="2000"
frameborder="0"
sandbox="allow-scripts allow-top-navigation"
></iframe>
</html>
' width="120%" height="2000" frameborder="0" sandbox="allow-scripts allow-top-navigation"></iframe>

</html>
Loading