aboutsummaryrefslogtreecommitdiffstats
path: root/bin/tfl
diff options
context:
space:
mode:
Diffstat (limited to 'bin/tfl')
-rwxr-xr-xbin/tfl/auto-close-reports48
-rwxr-xr-xbin/tfl/import_categories2
2 files changed, 49 insertions, 1 deletions
diff --git a/bin/tfl/auto-close-reports b/bin/tfl/auto-close-reports
new file mode 100755
index 000000000..00d310811
--- /dev/null
+++ b/bin/tfl/auto-close-reports
@@ -0,0 +1,48 @@
+#!/usr/bin/env perl
+
+# Closes reports that meet the following criteria:
+# * status is action scheduled
+# * in a category with a fixed - council auto response template
+# * over n days in action scheduled state (n is an argument)
+#
+# Reports matching these criteria are marked as fixed - council and the
+# relevant response template text is added as a comment.
+
+use warnings;
+use v5.14;
+use utf8;
+
+BEGIN {
+ use File::Basename qw(dirname);
+ use File::Spec;
+ my $d = dirname(File::Spec->rel2abs($0));
+ require "$d/../../setenv.pl";
+}
+
+use FixMyStreet;
+use Getopt::Long;
+use FixMyStreet::Script::TfL::AutoClose;
+
+my %h;
+GetOptions(\%h, 'verbose|v', 'days|d', 'help|h', 'commit|c');
+pod2usage(0) if $h{help};
+
+FixMyStreet::Script::TfL::AutoClose->new(%h)->close;
+
+__END__
+
+=head1 NAME
+
+auto-close-reports - set action_scheduled reports to fixed
+
+=head1 SYNOPSIS
+
+auto-close-reports --commit
+
+ Options:
+ --commit Actually close any reports
+ --days Number of days before autoclosing
+ --verbose Output how many reports have been closed
+ --help This help message
+
+=cut
diff --git a/bin/tfl/import_categories b/bin/tfl/import_categories
index bb48ddc4e..d3b99547c 100755
--- a/bin/tfl/import_categories
+++ b/bin/tfl/import_categories
@@ -65,7 +65,7 @@ for my $group (keys %$groups) {
$child_cat->note($child_cat->in_storage ? 'Updated by import_categories' : 'Created by import_categories');
say colored("WARNING", 'red') . " " . $child_cat->category . " already exists" if $child_cat->in_storage and $child_cat->category ne 'Other (TfL)';
my $groups = $child_cat->groups;
- my %groups = map { $_ => 1} @$groups;
+ my %groups = map { $_ => 1 } grep { $_ } @$groups;
$groups{$group} = 1;
my @groups = keys %groups;
$child_cat->extra(undef) if $child_cat->in_storage;