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

Schedule report tasks and add report preview view #1620

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

GregKaleka
Copy link
Collaborator

@GregKaleka GregKaleka commented Jan 29, 2025

  • Significantly improved the speed of the "Do Everything" (DE) button by restricting the data imports to the most recent two versions (for diffing), when before they were importing everything, taking hours. Should now take less than an hour to complete.
  • Added actual report generation and caching to the DE button (this takes only a few extra seconds)
  • Added a weekly scheduled task that runs the DE process
  • Added a url and view for staff only that shows the cached report for a given version if it exists, available at /releases/<version_slug>/report

Note: I have not implemented PDF rendering. I can do so, but wanted to have some discussion about what library to use. I've used WeasyPrint in the past, and the results have been good, though I recall the dev experience being annoying (someone on the team was always having to install some supporting thing on their machine).

Update: I attempted to get PDF rendering working with weasyprint. The results were close but I could not get some of the styling to work. In agreement with Rob, we're going to move forward with this html-only version for now, since it takes a lot of the manual work out already. We can revisit programmatic PDF rendering in the future.

Fixes #1603

email = person_data.pop("email") or generate_fake_email(
f"{person_data['first_name']} {person_data['last_name']}"
)
if not (user := User.objects.filter(email=email).first()):
Copy link
Collaborator

Choose a reason for hiding this comment

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

nitpick: the brackets here probably aren't needed?


return handled_commits


def check_credentials() -> list[str]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Small thing to think about rather than a blocker. I'm not sure about the naming of this. I think it could be something more intuitive maybe. The first impression from the use later would be that check_credentials would return a bool. Maybe something like list_missing_credentials would be more intuitive?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not set on that name either if you can think of something better.



@method_decorator(staff_member_required, name="get")
class ReportPreviewView(View):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it worth using the BoostVersionMixin here to have centralized handling of that for consistency.

Copy link
Collaborator

@daveoconnor daveoconnor left a comment

Choose a reason for hiding this comment

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

A few minor comments, mostly looks good. Approved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Scheduled task for updated weekly release report preview
2 participants