Skip to content

Commit

Permalink
[Open311] Add --exclude to bin/open311-populate-service-list
Browse files Browse the repository at this point in the history
Allows bodies to be excluded from Open311 service list fetching.
  • Loading branch information
davea committed Sep 19, 2024
1 parent 65b55d9 commit caae438
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
- Cobrands can provide per-category custom distances for duplicate lookup. #4746 #5162
- Add perl 5.38 support.
- Add plain text template previews to /_dev/email. #5105
- Add --exclude option to bin/open311-populate-service-list
- Performance improvements:
- Reduce database queries on shortlist page.
- Provide ResultSet fallback translation in lookup.
Expand Down
4 changes: 4 additions & 0 deletions bin/open311-populate-service-list
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use Getopt::Long::Descriptive;
my ($opt, $usage) = describe_options(
'%c %o',
['body|b:s', "body name to only fetch this body"],
['exclude|e:s@', 'body name(s) to exclude from fetching' ],
['verbose|v', "print out all services as they are found"],
['warn|w', "output warnings about any issues"],
['help', "print usage message and exit" ],
Expand All @@ -29,6 +30,9 @@ my $bodies = FixMyStreet::DB->resultset('Body')->search( {
if ($opt->body) {
$bodies = $bodies->search({ name => $opt->body });
}
if (my $exclude = $opt->exclude) {
$bodies = $bodies->search({ name => { -not_in => $exclude } });
}

my $verbose = 0;
$verbose = 1 if $opt->warn;
Expand Down

0 comments on commit caae438

Please sign in to comment.