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

Change minimum submission removal limit to 0 #4819

Merged

Conversation

robinmolen
Copy link
Contributor

Closes #4815

Changes

Allowing submissions to be deleted after 0 days.

Checklist

Check off the items that are completed or not relevant.

  • Impact on features

    • Checked copying a form
    • Checked import/export of a form
    • Config checks in the configuration overview admin page
    • Problem detection in the admin email digest is handled
  • Release management

    • I have labelled the PR as "needs-backport" accordingly
  • I have updated the translations assets (you do NOT need to provide translations)

    • Ran ./bin/makemessages_js.sh
    • Ran ./bin/compilemessages_js.sh
  • Commit hygiene

    • Commit messages refer to the relevant Github issue
    • Commit messages explain the "why" of change, not the how

Copy link

codecov bot commented Nov 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.55%. Comparing base (957b7c1) to head (9e77550).
Report is 5 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4819   +/-   ##
=======================================
  Coverage   96.55%   96.55%           
=======================================
  Files         748      748           
  Lines       25423    25423           
  Branches     3362     3362           
=======================================
  Hits        24548    24548           
  Misses        610      610           
  Partials      265      265           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@robinmolen robinmolen marked this pull request as ready for review November 12, 2024 09:29
Copy link
Member

@sergei-maertens sergei-maertens left a comment

Choose a reason for hiding this comment

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

I would like to see a test that creates a submission on timestamp t0 with a form configured to delete submissions after 0 days, and then the delete_submissions is invoked a couple of hours later (e.g. submission create at 18:00 and delete runs at 01:00 AM) to confirm that the submission is then indeed deleted.

I'm seeing some code with the annotations of how old a submission is that I'm not 100% convinced yet this patch fully resolves the problem.

all_submissions_removal_limit=7,
)

with freeze_time(lambda: datetime(2024, 11, 12, 18)):
Copy link
Member

Choose a reason for hiding this comment

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

what's up with the lambda? Is there a reason you can't do:

with freeze_time("2024-11-12T18:00:00+01:00"):

furthermore, never ever use naive datetimes in python/django (yours is naive, because no tzinfo has been specified). Generally you want to use the django wrappers defined in django.utils.timezone.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah yeah, that lambda isn't needed 👍

Ah okay, check. I'll keep it in mind

@sergei-maertens sergei-maertens self-requested a review November 13, 2024 21:51
@robinmolen robinmolen force-pushed the feature/4815-allow-zero-day-submission-pruning branch from 74747f9 to e39f7a3 Compare November 14, 2024 09:33
@robinmolen robinmolen force-pushed the feature/4815-allow-zero-day-submission-pruning branch from e39f7a3 to 9e77550 Compare November 14, 2024 10:30
@sergei-maertens sergei-maertens merged commit c50aa99 into master Nov 14, 2024
34 checks passed
@sergei-maertens sergei-maertens deleted the feature/4815-allow-zero-day-submission-pruning branch November 14, 2024 11:21
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.

Entering '0' days for the submission pruning appears to have no effect
2 participants