support description-embedded locations with multiple states #1465
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.
What does this PR do? 🛠️
Our solution to parsing location information from alert description text (#1296) incorrectly assumed that these alerts would only contain locations for a single state. When an alert covering more than one state is included, we mistakenly parse the heading for that state (the part that reads
IN [STATE] THIS WARNING INCLUDES [NUMBER] COUNTIES
) as being the heading for a group of counties.This is primarily a presentation bug, as the total list of counties and their appropriate county area headings all continue to be displayed as expected. There's just one (or more) weird headings. This PR removes the weird headings.
Rather than trying to finagle the regex to either exclude the extra state headings or break on them, I opted to instead add a filter to our county region heading checks. Since our existing regex will capture the state headings as county region headings, I just skip any entries in our built-up list of county region headings that are, in fact, state headings. (The code is probably clearer than written English...)
What does the reviewer need to know? 🤔
Screenshots (if appropriate): 📸
before
after