aboutsummaryrefslogtreecommitdiffstats
path: root/bin/fetch-reports-24hs
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2019-10-16 12:37:52 +0100
committerMatthew Somerville <matthew@mysociety.org>2020-04-02 17:14:20 +0100
commit1f0473c9844b6e32338d1c1af6e368f3387e8890 (patch)
treede1edb52f27957ad4c6c35be850f91389ca09f16 /bin/fetch-reports-24hs
parentd44c06c213bc73632893ab58421ab98b7058b913 (diff)
Combine and improve fetch-comments/reports scripts
Make them take start/end hour arguments, cope if only one given, optional body, and combine them together in one `fetch` script.
Diffstat (limited to 'bin/fetch-reports-24hs')
-rwxr-xr-xbin/fetch-reports-24hs37
1 files changed, 4 insertions, 33 deletions
diff --git a/bin/fetch-reports-24hs b/bin/fetch-reports-24hs
index ec0eabc2e..ffc1e9e72 100755
--- a/bin/fetch-reports-24hs
+++ b/bin/fetch-reports-24hs
@@ -1,35 +1,6 @@
-#!/usr/bin/env perl
+#!/bin/bash
#
-# This script utilises Open311 as described at
-# http://wiki.open311.org/GeoReport_v2/#get-service-requests
-# to fetch service requests.
+# Wrapper to call new script
-use strict;
-use warnings;
-require 5.8.0;
-
-BEGIN {
- use File::Basename qw(dirname);
- use File::Spec;
- my $d = dirname(File::Spec->rel2abs($0));
- require "$d/../setenv.pl";
-}
-
-use DateTime;
-
-use CronFns;
-my ($verbose, $nomail) = CronFns::options();
-
-use Open311::GetServiceRequests;
-
-my $dt = DateTime->now();
-my $dt_24hrs_ago = $dt->clone;
-$dt_24hrs_ago->add( hours => -24 );
-
-my $reports = Open311::GetServiceRequests->new(
- verbose => 1,
- start_date => $dt_24hrs_ago,
- end_date => $dt
-);
-
-$reports->fetch;
+DIR="$(cd "$(dirname "$BASH_SOURCE")" && pwd -P)"
+$DIR/fetch --reports --start 24