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

changed the default to multi url pattern #1216

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ For each PR made, an entry should be added to this changelog. It should contain
- etc.

## Changelog
- 1209-bug-fix-document-type-creator-form
- Description: The dropdown on the pattern creation form needs to be set as multi as the default option since this is why the doc type creator form is used for the majority of multi-URL pattern creations. This should be applied to doc types, division types, and titles as well.
- Changes:
- Set the default value for `match_pattern_type` in `BaseMatchPattern` class is set to `2`
- Changed `test_create_simple_exclude_pattern` test within `TestDeltaExcludePatternBasics`
- Changed `test_create_division_pattern` and `test_create_document_type_pattern_single` within `TestFieldModifierPatternBasics`
2 changes: 1 addition & 1 deletion sde_collections/models/delta_patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class MatchPatternTypeChoices(models.IntegerChoices):
match_pattern = models.CharField(
"Pattern", help_text="This pattern is compared against the URL of all documents in the collection"
)
match_pattern_type = models.IntegerField(choices=MatchPatternTypeChoices.choices, default=1)
match_pattern_type = models.IntegerField(choices=MatchPatternTypeChoices.choices, default=2)
delta_urls = models.ManyToManyField(
"DeltaUrl",
related_name="%(class)ss", # Makes delta_url.deltaincludepatterns.all()
Expand Down
2 changes: 1 addition & 1 deletion sde_collections/tests/test_exclude_patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def test_create_simple_exclude_pattern(self):
pattern = DeltaExcludePattern.objects.create(
collection=self.collection, match_pattern="https://example.com/exclude-me", reason="Test exclusion"
)
assert pattern.match_pattern_type == DeltaExcludePattern.MatchPatternTypeChoices.INDIVIDUAL_URL
assert pattern.match_pattern_type == DeltaExcludePattern.MatchPatternTypeChoices.MULTI_URL_PATTERN

def test_exclude_single_curated_url(self):
"""Test excluding a single curated URL creates appropriate delta."""
Expand Down
2 changes: 2 additions & 0 deletions sde_collections/tests/test_field_modifier_patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def test_create_document_type_pattern_single(self):
collection=self.collection,
match_pattern="https://example.com/docs/guide.pdf",
document_type=DocumentTypes.DOCUMENTATION,
match_pattern_type=DeltaDocumentTypePattern.MatchPatternTypeChoices.INDIVIDUAL_URL,
)
assert pattern.match_pattern_type == DeltaDocumentTypePattern.MatchPatternTypeChoices.INDIVIDUAL_URL
assert pattern.document_type == DocumentTypes.DOCUMENTATION
Expand All @@ -68,6 +69,7 @@ def test_create_division_pattern(self):
collection=self.collection,
match_pattern="https://example.com/helio/data.html",
division=Divisions.HELIOPHYSICS,
match_pattern_type=DeltaDivisionPattern.MatchPatternTypeChoices.INDIVIDUAL_URL,
)
assert pattern.match_pattern_type == DeltaDivisionPattern.MatchPatternTypeChoices.INDIVIDUAL_URL
assert pattern.division == Divisions.HELIOPHYSICS
Expand Down