Repository navigation
Conversation
The PDF filename only names the period, so generating a report for the same period again overwrote the earlier report's file, and the earlier report then served the newer numbers. Store it under REPORTS_DIR/<report_id>/ so the download name stays the same. Fixes fireform-core#765
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #765
Problem
ReportingService.generate_reportsaved the PDF asREPORTS_DIR/FireForm_Monthly_2024-07.pdf, and that name only identifies the period. Generating a report for a period that already had one overwrote the earlier report's file. The earlier report then served the newer PDF, whose numbers don't match its own storedsummary/json_data.Change
app/services/reporting.py: the PDF is now written toREPORTS_DIR/<report_id>/FireForm_Monthly_2024-07.pdf._generate_pdfalready creates the parent folder.GET /reports/{id}route takes the download name from the file name, so it's unchanged: users still getFireForm_Monthly_2024-07.pdf.pdf_path, so they still work.Tests
test_report_pdf_not_overwritten_by_later_report_for_same_periodgenerates July 2024 twice, with a new submission in between. It checks that:developmentit fails because both reports point to the same file.ruff check app/is clean.