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

feat: admin action to delete all segments for project #2646

Merged
merged 6 commits into from
Aug 15, 2023

Conversation

matthewelwell
Copy link
Contributor

Changes

Adds an admin action to delete all segments for a project.

This is mostly a support tool for a particular customer that breached the limit of segments and we need to clear them down. Since django handles cascading manually, it is challenging / risky to delete them manually in the database.

How did you test this code?

Added unit test and tested manually.

@vercel
Copy link

vercel bot commented Aug 14, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 15, 2023 9:47am
flagsmith-frontend-preview ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 15, 2023 9:47am
flagsmith-frontend-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 15, 2023 9:47am

@github-actions
Copy link
Contributor

github-actions bot commented Aug 14, 2023

Uffizzi Preview deployment-33364 was deleted.

@codecov-commenter
Copy link

codecov-commenter commented Aug 14, 2023

Codecov Report

Patch coverage: 96.66% and project coverage change: -0.01% ⚠️

Comparison is base (1514bf7) 95.44% compared to head (811c0c4) 95.43%.
Report is 14 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2646      +/-   ##
==========================================
- Coverage   95.44%   95.43%   -0.01%     
==========================================
  Files         976      976              
  Lines       27319    27294      -25     
==========================================
- Hits        26074    26049      -25     
  Misses       1245     1245              
Files Changed Coverage Δ
...pi/tests/unit/projects/test_unit_projects_admin.py 94.11% <94.11%> (ø)
api/audit/serializers.py 100.00% <100.00%> (ø)
api/environments/serializers.py 95.52% <100.00%> (-0.32%) ⬇️
api/environments/views.py 90.59% <100.00%> (+1.16%) ⬆️
api/organisations/views.py 91.16% <100.00%> (ø)
api/projects/admin.py 100.00% <100.00%> (ø)
api/projects/serializers.py 100.00% <100.00%> (ø)
api/projects/tests/test_serializers.py 100.00% <100.00%> (ø)
api/projects/views.py 94.01% <100.00%> (-0.30%) ⬇️

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

@@ -9,6 +11,10 @@
from projects.tags.models import Tag
from segments.models import Segment

if typing.TYPE_CHECKING:
Copy link
Member

Choose a reason for hiding this comment

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

Why are we only importing them if TYPE_CHECKING?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because we only need them for typing.

Copy link
Member

@gagantrivedi gagantrivedi Aug 15, 2023

Choose a reason for hiding this comment

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

Is that the convention? Because both of them are going to be available at runtime anyway, and that if is a bit ugly? What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, fair enough - I'm not too sure what the convention is. Seems like it should only really be used to avoid circular dependencies. I'll remove.

Copy link
Member

@gagantrivedi gagantrivedi left a comment

Choose a reason for hiding this comment

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

one small comment

@matthewelwell matthewelwell merged commit 4df1b80 into main Aug 15, 2023
@matthewelwell matthewelwell deleted the feat/delete-all-segments-for-project branch August 15, 2023 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api Issue related to the REST API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants