-
Notifications
You must be signed in to change notification settings - Fork 415
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: Add version_of
and matches to rules and conditions
#4988
Open
zachaysan
wants to merge
28
commits into
main
Choose a base branch
from
feat/add_version_of_to_rules_and_conditions
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+738
−13
Open
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
0b6c551
Version rules and conditions
zachaysan 1e874e8
Create tests for versioned rules and conditions as well as matches
zachaysan 6eb58a0
Add version_of fields and add matches for segments rules and conditions
zachaysan 80fd54e
Merge branch 'main' into feat/add_version_of_to_rules_and_conditions
zachaysan 3c5ffea
Update lock file and pyproject.toml
zachaysan 10ba9d1
Alter test to cover case where rule is already parted of the matched …
zachaysan 11e387c
Add docstrings, change variables to `self_` and remove pragma: no cover
zachaysan 760fd6a
Fix conflicts and merge branch 'main' into feat/add_version_of_to_rul…
zachaysan d349a62
Update method name and associated tests
zachaysan 3c204af
Update method names and add more info to docstrings
zachaysan 3dcede8
Fix conflicts and merge branch 'main' into feat/add_version_of_to_rul…
zachaysan 6351031
Update docstrings, add comments, and refactor condition matching logic
zachaysan d97e9b3
Add comments, update conditions for test, and create new condition ex…
zachaysan 4ee905f
Fix conflicts and merge branch 'main' into feat/add_version_of_to_rul…
zachaysan e21c783
Create test for case where no conditions match
zachaysan 19039b2
Update docstrings and variable names
zachaysan f578619
Update method names
zachaysan 17defee
Update comments and docstring
zachaysan e2a63be
Update comments
zachaysan 79a7720
Update poetry.lock with latest common
zachaysan 692fc5f
Fix flaky migration
zachaysan aac17a3
Add create project level change requests
zachaysan fb4b633
Fix conflicts and merge branch 'main' into feat/add_version_of_to_rul…
zachaysan e460601
Fix migrations post merge
matthewelwell 6e5894e
Merge branch 'refs/heads/main' into feat/add_version_of_to_rules_and_…
matthewelwell fc8b581
feat(segment-crs): code reabability improvements to #4988 (#5054)
matthewelwell 9ba8ca3
Check for target conditions due to the exact matching case
zachaysan 41ec3ad
Merge branch 'main' into feat/add_version_of_to_rules_and_conditions
zachaysan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
33 changes: 33 additions & 0 deletions
33
api/projects/migrations/0027_add_create_project_level_change_requests.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
from common.projects.permissions import CREATE_PROJECT_LEVEL_CHANGE_REQUESTS | ||
from django.db import migrations | ||
|
||
from permissions.models import PROJECT_PERMISSION_TYPE | ||
|
||
|
||
def remove_default_project_permissions(apps, schema_model): # pragma: no cover | ||
PermissionModel = apps.get_model("permissions", "PermissionModel") | ||
PermissionModel.objects.get(key=CREATE_PROJECT_LEVEL_CHANGE_REQUESTS).delete() | ||
|
||
|
||
def insert_default_project_permissions(apps, schema_model): | ||
PermissionModel = apps.get_model("permissions", "PermissionModel") | ||
|
||
create_description = "Ability to create project level change requests." | ||
|
||
PermissionModel.objects.get_or_create( | ||
key=CREATE_PROJECT_LEVEL_CHANGE_REQUESTS, | ||
type=PROJECT_PERMISSION_TYPE, | ||
defaults={"description": create_description}, | ||
) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [("projects", "0026_add_change_request_approval_limit_to_projects")] | ||
|
||
operations = [ | ||
migrations.RunPython( | ||
insert_default_project_permissions, | ||
reverse_code=remove_default_project_permissions, | ||
), | ||
] |
This file contains 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
60 changes: 60 additions & 0 deletions
60
api/segments/migrations/0028_version_rules_and_conditions.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Generated by Django 4.2.17 on 2025-01-08 15:21 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("segments", "0027_historicalsegmentrule"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="condition", | ||
name="version_of", | ||
field=models.ForeignKey( | ||
blank=True, | ||
null=True, | ||
on_delete=django.db.models.deletion.SET_NULL, | ||
related_name="versioned_conditions", | ||
to="segments.condition", | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="historicalcondition", | ||
name="version_of", | ||
field=models.ForeignKey( | ||
blank=True, | ||
db_constraint=False, | ||
null=True, | ||
on_delete=django.db.models.deletion.DO_NOTHING, | ||
related_name="+", | ||
to="segments.condition", | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="segmentrule", | ||
name="version_of", | ||
field=models.ForeignKey( | ||
blank=True, | ||
null=True, | ||
on_delete=django.db.models.deletion.SET_NULL, | ||
related_name="versioned_rules", | ||
to="segments.segmentrule", | ||
), | ||
), | ||
migrations.AddField( | ||
model_name="historicalsegmentrule", | ||
name="version_of", | ||
field=models.ForeignKey( | ||
blank=True, | ||
db_constraint=False, | ||
null=True, | ||
on_delete=django.db.models.deletion.DO_NOTHING, | ||
related_name="+", | ||
to="segments.segmentrule", | ||
), | ||
), | ||
] |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's remember to update these once we've got builds in those packages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea.