aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Arter <davea@mysociety.org>2017-07-24 16:09:27 +0100
committerDave Arter <davea@mysociety.org>2017-07-24 17:12:18 +0100
commit3fb659de784e8cc40817f072f7181187f460f860 (patch)
treea137b8258b760d6659604d08d7a6b7a51bfe7aaf
parent362b8ca38939ca35dff8a04c0ac3434e6b3559cc (diff)
[Oxfordshire] RDI file should show all inspections as happening on the same date
Fixes mysociety/fixmystreetforcouncils#203
-rwxr-xr-xbin/oxfordshire/send-rdi-emails2
-rw-r--r--perllib/FixMyStreet/App/Controller/Admin/ExorDefects.pm1
-rw-r--r--perllib/FixMyStreet/Integrations/ExorRDI.pm8
-rw-r--r--t/cobrand/oxfordshire.t4
4 files changed, 9 insertions, 6 deletions
diff --git a/bin/oxfordshire/send-rdi-emails b/bin/oxfordshire/send-rdi-emails
index ef0931d6c..11e7a6fe9 100755
--- a/bin/oxfordshire/send-rdi-emails
+++ b/bin/oxfordshire/send-rdi-emails
@@ -21,6 +21,7 @@ use FixMyStreet::Integrations::ExorRDI;
my $end_date = DateTime->now( time_zone => FixMyStreet->time_zone || FixMyStreet->local_time_zone )
->truncate(to => 'hour')->set_hour(16);
my $start_date = $end_date->clone->subtract(days => 1);
+my $inspection_date = $end_date; # All inspections are considered to have happened on the same date.
my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker('oxfordshire')->new;
$cobrand->set_lang_and_domain('en-gb', 1);
@@ -35,6 +36,7 @@ foreach my $inspector (@inspectors) {
my $params = {
start_date => $start_date,
end_date => $end_date,
+ inspection_date => $inspection_date,
user => $inspector,
};
my $rdi = FixMyStreet::Integrations::ExorRDI->new($params);
diff --git a/perllib/FixMyStreet/App/Controller/Admin/ExorDefects.pm b/perllib/FixMyStreet/App/Controller/Admin/ExorDefects.pm
index 1711ecb10..b03a2ab98 100644
--- a/perllib/FixMyStreet/App/Controller/Admin/ExorDefects.pm
+++ b/perllib/FixMyStreet/App/Controller/Admin/ExorDefects.pm
@@ -56,6 +56,7 @@ sub download : Path('download') : Args(0) {
my $params = {
start_date => $start_date,
+ inspection_date => $start_date,
end_date => $end_date + $one_day,
user => $c->get_param('user_id'),
};
diff --git a/perllib/FixMyStreet/Integrations/ExorRDI.pm b/perllib/FixMyStreet/Integrations/ExorRDI.pm
index dab307fff..87565767a 100644
--- a/perllib/FixMyStreet/Integrations/ExorRDI.pm
+++ b/perllib/FixMyStreet/Integrations/ExorRDI.pm
@@ -23,7 +23,7 @@ use Scalar::Util 'blessed';
use FixMyStreet::DB;
use namespace::clean;
-has [qw(start_date end_date)] => (
+has [qw(start_date end_date inspection_date)] => (
is => 'ro',
required => 1,
);
@@ -154,8 +154,8 @@ sub construct {
$link_id, # area/link id, fixed value for our purposes
"","", # must be empty
$initials || "XX", # inspector initials
- $self->start_date->strftime("%y%m%d"), # date of inspection yymmdd
- "0700", # time of inspection hhmm, set to static value for now
+ $self->inspection_date->strftime("%y%m%d"), # date of inspection yymmdd
+ "1600", # time of inspection hhmm, set to static value for now
"D", # inspection variant, should always be D
"INS", # inspection type, always INS
"N", # Area of the county - north (N) or south (S)
@@ -204,7 +204,7 @@ has filename => (
is => 'lazy',
default => sub {
my $self = shift;
- my $start = $self->start_date->strftime("%Y%m%d");
+ my $start = $self->inspection_date->strftime("%Y%m%d");
my $end = $self->end_date->strftime("%Y%m%d");
my $filename = sprintf("exor_defects-%s-%s.rdi", $start, $end);
if ( $self->user ) {
diff --git a/t/cobrand/oxfordshire.t b/t/cobrand/oxfordshire.t
index ecc5f32a0..c081f6cbf 100644
--- a/t/cobrand/oxfordshire.t
+++ b/t/cobrand/oxfordshire.t
@@ -113,13 +113,13 @@ subtest 'Exor file looks okay' => sub {
$rdi =~ s/(I,[FM]C,,)\d+/$1XXX/g; # Remove unique ID figures, unknown order
is $rdi, <<EOF, "RDI file matches expected";
"1,1.8,1.0.0.0,ENHN,"
-"G,1989169,,,XX,170505,0700,D,INS,N,,,,"
+"G,1989169,,,XX,170505,1600,D,INS,N,,,,"
"H,FC"
"I,FC,,XXX,"434970E 209683N Nearest postcode: OX28 4DS.",1200,,,,,,,,"TM none","123 ""
"J,SFP1,2,,,434970,209683,,,,,"
"M,resolve,,,/CFC,,"
"P,0,999999"
-"G,1989169,,,XX,170505,0700,D,INS,N,,,,"
+"G,1989169,,,XX,170505,1600,D,INS,N,,,,"
"H,MC"
"I,MC,,XXX,"434970E 209683N Nearest postcode: OX28 4DS.",1200,,,,,,,,"TM none","124 ""
"J,SFP2,2,,,434970,209683,,,,,"