Skip to content

Commit a173a80

Browse files
authored
Merge pull request #1216 from NASA-IMPACT/1209-bug-fix-document-type-creator-form
changed the default to multi url pattern
2 parents 3388dea + 485cfdb commit a173a80

File tree

5 files changed

+21
-12
lines changed

5 files changed

+21
-12
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ For each PR made, an entry should be added to this changelog. It should contain
1212
- etc.
1313

1414
## Changelog
15+
- 1209-bug-fix-document-type-creator-form
16+
- 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.
17+
- Changes:
18+
- Set the default value for `match_pattern_type` in `BaseMatchPattern` class is set to `2`
19+
- Changed `test_create_simple_exclude_pattern` test within `TestDeltaExcludePatternBasics`
20+
- Changed `test_create_division_pattern` and `test_create_document_type_pattern_single` within `TestFieldModifierPatternBasics`
21+
1522
- 1052-update-cosmos-to-create-jobs-for-scrapers-and-indexers
1623
- Description: The original automation set up to generate the scrapers and indexers automatically based on a collection workflow status change needed to be updated to more accurately reflect the curation workflow. It would also be good to generate the jobs during this process to streamline the same.
1724
- Changes:

sde_collections/models/delta_patterns.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class MatchPatternTypeChoices(models.IntegerChoices):
3030
match_pattern = models.CharField(
3131
"Pattern", help_text="This pattern is compared against the URL of all documents in the collection"
3232
)
33-
match_pattern_type = models.IntegerField(choices=MatchPatternTypeChoices.choices, default=1)
33+
match_pattern_type = models.IntegerField(choices=MatchPatternTypeChoices.choices, default=2)
3434
delta_urls = models.ManyToManyField(
3535
"DeltaUrl",
3636
related_name="%(class)ss", # Makes delta_url.deltaincludepatterns.all()

sde_collections/tests/test_exclude_patterns.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def test_create_simple_exclude_pattern(self):
5656
pattern = DeltaExcludePattern.objects.create(
5757
collection=self.collection, match_pattern="https://example.com/exclude-me", reason="Test exclusion"
5858
)
59-
assert pattern.match_pattern_type == DeltaExcludePattern.MatchPatternTypeChoices.INDIVIDUAL_URL
59+
assert pattern.match_pattern_type == DeltaExcludePattern.MatchPatternTypeChoices.MULTI_URL_PATTERN
6060

6161
def test_exclude_single_curated_url(self):
6262
"""Test excluding a single curated URL creates appropriate delta."""

sde_collections/tests/test_field_modifier_patterns.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def test_create_document_type_pattern_single(self):
4747
collection=self.collection,
4848
match_pattern="https://example.com/docs/guide.pdf",
4949
document_type=DocumentTypes.DOCUMENTATION,
50+
match_pattern_type=DeltaDocumentTypePattern.MatchPatternTypeChoices.INDIVIDUAL_URL,
5051
)
5152
assert pattern.match_pattern_type == DeltaDocumentTypePattern.MatchPatternTypeChoices.INDIVIDUAL_URL
5253
assert pattern.document_type == DocumentTypes.DOCUMENTATION
@@ -68,6 +69,7 @@ def test_create_division_pattern(self):
6869
collection=self.collection,
6970
match_pattern="https://example.com/helio/data.html",
7071
division=Divisions.HELIOPHYSICS,
72+
match_pattern_type=DeltaDivisionPattern.MatchPatternTypeChoices.INDIVIDUAL_URL,
7173
)
7274
assert pattern.match_pattern_type == DeltaDivisionPattern.MatchPatternTypeChoices.INDIVIDUAL_URL
7375
assert pattern.division == Divisions.HELIOPHYSICS

sde_indexing_helper/templates/sde_collections/delta_urls_list.html

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -442,10 +442,10 @@ <h5 class="modal-title" id="excludePatternModalLabel">Exclude Pattern Form</h5>
442442
<div class="form-group pattern-form-group">
443443
<label for="pattern_type_input" class="form-label">Pattern Type<div class="asterik">*</div></label>
444444
<div class="input-group">
445-
<input type="hidden" name="match_pattern_type" class="form-control" id="pattern_type_input" required>
445+
<input type="hidden" name="match_pattern_type" class="form-control" id="pattern_type_input" value="2" required>
446446
<div class="input-group-append pattern-dropdown-input">
447447
<button class="btn btn-secondary btn-block dropdown-toggle pattern-dropdown" type="button"
448-
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Select Pattern Type</button>
448+
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Multi-URL Pattern</button>
449449
<div class="pattern-type-form dropdown-menu">
450450
<a class="dropdown-item pattern_type_form_select" value="1">Individual URL Pattern</a>
451451
<a class="dropdown-item pattern_type_form_select" value="2">Multi-URL Pattern</a>
@@ -483,10 +483,10 @@ <h5 class="modal-title" id="includePatternModalLabel">Include Pattern Form</h5>
483483
<div class="form-group pattern-form-group">
484484
<label for="pattern_type_input" class="form-label">Pattern Type<div class="asterik">*</div></label>
485485
<div class="input-group">
486-
<input type="hidden" name="match_pattern_type" class="form-control" id="pattern_type_input" required>
486+
<input type="hidden" name="match_pattern_type" class="form-control" id="pattern_type_input" value="2" required>
487487
<div class="input-group-append pattern-dropdown-input">
488488
<button class="btn btn-secondary btn-block dropdown-toggle pattern-dropdown" type="button"
489-
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Select Pattern Type</button>
489+
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Multi-URL Pattern</button>
490490
<div class="pattern-type-form dropdown-menu">
491491
<a class="dropdown-item pattern_type_form_select" value="1">Individual URL Pattern</a>
492492
<a class="dropdown-item pattern_type_form_select" value="2">Multi-URL Pattern</a>
@@ -527,10 +527,10 @@ <h5 class="modal-title" id="titlePatternModalLabel">Title Pattern Form</h5>
527527
<div class="form-group pattern-form-group">
528528
<label for="pattern_type_input" class="form-label">Pattern Type<div class="asterik">*</div></label>
529529
<div class="input-group">
530-
<input type="hidden" name="match_pattern_type" class="form-control" id="pattern_type_input" required>
530+
<input type="hidden" name="match_pattern_type" class="form-control" id="pattern_type_input" value="2" required>
531531
<div class="input-group-append pattern-dropdown-input">
532532
<button class="btn btn-secondary btn-block dropdown-toggle pattern-dropdown" type="button"
533-
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Select Pattern Type</button>
533+
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Multi-URL Pattern</button>
534534
<div class="pattern-type-form dropdown-menu">
535535
<a class="dropdown-item pattern_type_form_select" value="1">Individual URL Pattern</a>
536536
<a class="dropdown-item pattern_type_form_select" value="2">Multi-URL Pattern</a>
@@ -586,10 +586,10 @@ <h5 class="modal-title" id="documentTypePatternModalLabel">Document Type Pattern
586586
<div class="form-group pattern-form-group">
587587
<label for="pattern_type_input" class="form-label">Pattern Type<div class="asterik">*</div></label>
588588
<div class="input-group">
589-
<input type="hidden" name="match_pattern_type" class="form-control" id="pattern_type_input" required>
589+
<input type="hidden" name="match_pattern_type" class="form-control" id="pattern_type_input" value="2" required>
590590
<div class="input-group-append pattern-dropdown-input">
591591
<button class="btn btn-secondary btn-block dropdown-toggle pattern-dropdown" type="button"
592-
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Select Pattern Type</button>
592+
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Multi-URL Pattern</button>
593593
<div class="pattern-type-form dropdown-menu">
594594
<a class="dropdown-item pattern_type_form_select" value="1">Individual URL Pattern</a>
595595
<a class="dropdown-item pattern_type_form_select" value="2">Multi-URL Pattern</a>
@@ -644,10 +644,10 @@ <h5 class="modal-title" id="divisionPatternModalLabel">Division Pattern Form</h5
644644
<div class="form-group pattern-form-group">
645645
<label for="pattern_type_input" class="form-label">Pattern Type<div class="asterik">*</div></label>
646646
<div class="input-group">
647-
<input type="hidden" name="match_pattern_type" class="form-control" id="pattern_type_input" required>
647+
<input type="hidden" name="match_pattern_type" class="form-control" id="pattern_type_input" value="2" required>
648648
<div class="input-group-append pattern-dropdown-input">
649649
<button class="btn btn-secondary btn-block dropdown-toggle pattern-dropdown" type="button"
650-
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Select Pattern Type</button>
650+
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Multi-URL Pattern</button>
651651
<div class="pattern-type-form dropdown-menu">
652652
<a class="dropdown-item pattern_type_form_select" value="1">Individual URL Pattern</a>
653653
<a class="dropdown-item pattern_type_form_select" value="2">Multi-URL Pattern</a>

0 commit comments

Comments
 (0)