diff options
author | Struan Donald <struan@exo.org.uk> | 2019-10-16 16:18:00 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2019-10-17 18:05:34 +0100 |
commit | b2a98a09c00a918b472ef5c97f48aa68b867571b (patch) | |
tree | ec064199b66bf3e8aec4320db15d08973e07bf3d /bin | |
parent | a30ae9a69b651b7cfb1c36dca2c25d04bb6f4fae (diff) |
[Northamptonshire] small tweaks to backfill script
Fix a couple of issues discovered in testing where the Response to
customer wasn't being detected in the database;
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/fixmystreet.com/one-off-status-update | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/bin/fixmystreet.com/one-off-status-update b/bin/fixmystreet.com/one-off-status-update index 43e24417e..e9ba66c75 100755 --- a/bin/fixmystreet.com/one-off-status-update +++ b/bin/fixmystreet.com/one-off-status-update @@ -119,6 +119,9 @@ if ($northants) { next; } + # we don't want to update hidden reports + next if $p->state eq 'hidden'; + my $new_state = get_state( $report ); unless ( $new_state ) { @@ -140,7 +143,14 @@ if ($northants) { my $text = $report->{Response_to_Customer}; # do not add a second response to customer if it's already there. if ($text) { - my $c = $p->comments->search({text => $text}); + # sometimes there are extra spaces on the end in the database + # there's also quite a few occurrences of the text having minor corrections + # to the thank you which we don't want to send out an update for potentially + # weeks later + my $search_text = $text; + $search_text =~ s/\sthank you[.\s]*$//i; + my $search = { text => { ilike => "$search_text%" } }; + my $c = $p->comments->search($search); $text = '' if $c->count; } |