diff --git a/core/jobs/playtime_entries.py b/core/jobs/playtime_entries.py index b68378446b..06313e5bab 100644 --- a/core/jobs/playtime_entries.py +++ b/core/jobs/playtime_entries.py @@ -130,13 +130,14 @@ def do_run(self): email_subject = ( f"Playtime Summaries {formatted_start_date} - {formatted_until_date}" ) - attachment_name = ( - f"playtime-summary-{formatted_start_date}-{formatted_until_date}" - ) + attachment_extension = "csv" + attachment_name = f"playtime-summary-{formatted_start_date}-{formatted_until_date}.{attachment_extension}" # Write to a temporary file so we don't overflow the memory with TemporaryFile( - "w+", prefix=f"playtimereport{formatted_until_date}", suffix="csv" + "w+", + prefix=f"playtimereport{formatted_until_date}", + suffix=attachment_extension, ) as temp: # Write the data as a CSV writer = csv.writer(temp) diff --git a/tests/core/jobs/test_playtime_entries.py b/tests/core/jobs/test_playtime_entries.py index 0cef68e379..fabcee2e36 100644 --- a/tests/core/jobs/test_playtime_entries.py +++ b/tests/core/jobs/test_playtime_entries.py @@ -294,7 +294,7 @@ def test_do_run(self, db: DatabaseTransactionFixture): receivers=["reporting@test.email"], text="", attachments={ - f"playtime-summary-{cutoff}-{until}": "" + f"playtime-summary-{cutoff}-{until}.csv": "" }, # Mock objects do not write data )