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

fix: feature segments created with priority 0 are sent to bottom #4383

Merged
merged 5 commits into from
Jul 24, 2024

Conversation

matthewelwell
Copy link
Contributor

Changes

The previous PR here actually causes an issue because the FE always defaults to sending the priority as 0.

This PR is in part accounting for that, but also accounting for the fact that the django-ordered-model library that we are using doesn't enforce uniqueness on the priority so, when the priority is set in the save, any subsequent calls to to() don't work because it early returns that it already exists at that priority. The issue is that we now likely have 2 feature segments at that priority. To resolve this, we first move the 'collision' feature segment down and out of the way before completing the save.

How did you test this code?

Added a bunch more tests for all scenarios.

@matthewelwell matthewelwell requested a review from a team as a code owner July 24, 2024 15:38
@matthewelwell matthewelwell requested review from novakzaballa and removed request for a team July 24, 2024 15:38
Copy link

vercel bot commented Jul 24, 2024

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

3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
docs ⬜️ Ignored (Inspect) Visit Preview Jul 24, 2024 5:13pm
flagsmith-frontend-preview ⬜️ Ignored (Inspect) Visit Preview Jul 24, 2024 5:13pm
flagsmith-frontend-staging ⬜️ Ignored (Inspect) Visit Preview Jul 24, 2024 5:13pm

@github-actions github-actions bot added the api Issue related to the REST API label Jul 24, 2024
Copy link
Contributor

github-actions bot commented Jul 24, 2024

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith:pr-4383 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-4383 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-api-test:pr-4383 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-e2e:pr-4383 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api:pr-4383 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-frontend:pr-4383 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-4383 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-4383 Finished ✅ Results

Copy link
Contributor

github-actions bot commented Jul 24, 2024

Uffizzi Preview deployment-54592 was deleted.

@matthewelwell matthewelwell changed the title Handle more scenarios for priority setting fix: feature segments created with priority 0 are sent to bottom Jul 24, 2024
@github-actions github-actions bot added the fix label Jul 24, 2024
@matthewelwell matthewelwell force-pushed the fix/handle-more-scenarios-for-priority-setting branch from 917ded1 to 3f1fb19 Compare July 24, 2024 16:50
@github-actions github-actions bot added fix and removed fix labels Jul 24, 2024
@matthewelwell matthewelwell requested a review from khvn26 July 24, 2024 16:51
Copy link

codecov bot commented Jul 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.83%. Comparing base (3452b8a) to head (fad7192).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4383   +/-   ##
=======================================
  Coverage   96.82%   96.83%           
=======================================
  Files        1165     1165           
  Lines       38568    38621   +53     
=======================================
+ Hits        37345    37398   +53     
  Misses       1223     1223           

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

@github-actions github-actions bot added fix and removed fix labels Jul 24, 2024
Copy link
Member

@khvn26 khvn26 left a comment

Choose a reason for hiding this comment

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

The new tests look exhaustive enough to me. 👍

@github-actions github-actions bot added fix and removed fix labels Jul 24, 2024
@matthewelwell matthewelwell added this pull request to the merge queue Jul 24, 2024
Merged via the queue into main with commit 3f745c5 Jul 24, 2024
32 checks passed
@matthewelwell matthewelwell deleted the fix/handle-more-scenarios-for-priority-setting branch July 24, 2024 17:23
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 fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants