diff options
author | Dave Arter <davea@mysociety.org> | 2017-02-13 15:13:12 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2017-03-23 12:54:24 +0000 |
commit | 3f21a9742d89c3e4fda47a0be6ec2a17f802c99a (patch) | |
tree | 3f199f8f6b43aa8818dc3c5349623bb2d4a5e8a3 /perllib/FixMyStreet/App/Controller/Admin/ExorDefects.pm | |
parent | 6fb4eca34fd47612216f642985cac74359727b15 (diff) |
Add customisable defect types.
Problems can have an associated defect type, that can be assigned during
an inspection. Include an admin interface for managing these types, that
can also be assigned on a per-category basis, currently available to the
Oxfordshire cobrand.
(Also include 'TM' in traffic management Exor RDI output.)
Diffstat (limited to 'perllib/FixMyStreet/App/Controller/Admin/ExorDefects.pm')
-rw-r--r-- | perllib/FixMyStreet/App/Controller/Admin/ExorDefects.pm | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/perllib/FixMyStreet/App/Controller/Admin/ExorDefects.pm b/perllib/FixMyStreet/App/Controller/Admin/ExorDefects.pm index 013d710af..201742c81 100644 --- a/perllib/FixMyStreet/App/Controller/Admin/ExorDefects.pm +++ b/perllib/FixMyStreet/App/Controller/Admin/ExorDefects.pm @@ -141,22 +141,32 @@ sub download : Path('download') : Args(0) { foreach my $report (@$inspections) { my ($eastings, $northings) = $report->local_coords; my $description = sprintf("%s %s", $report->external_id || "", $report->get_extra_metadata('detailed_information') || ""); + my $activity_code = $report->defect_type ? + $report->defect_type->get_extra_metadata('activity_code') + : 'MC'; + my $traffic_information = $report->get_extra_metadata('traffic_information') ? + 'TM ' . $report->get_extra_metadata('traffic_information') + : 'TM none'; + $csv->combine( "I", # beginning of defect record - "MC", # activity code - minor carriageway, also FC (footway) + $activity_code, # activity code - minor carriageway, also FC (footway) "", # empty field, can also be A (seen on MC) or B (seen on FC) sprintf("%03d", ++$i), # randomised sequence number "${eastings}E ${northings}N", # defect location field, which we don't capture from inspectors $report->inspection_log_entry->whenedited->strftime("%H%M"), # defect time raised "","","","","","","", # empty fields - $report->get_extra_metadata('traffic_information') ? 'TM required' : 'TM none', # further description + $traffic_information, $description, # defect description ); push @body, $csv->string; + my $defect_type = $report->defect_type ? + $report->defect_type->get_extra_metadata('defect_code') + : 'SFP2'; $csv->combine( "J", # georeferencing record - $report->get_extra_metadata('defect_type') || 'SFP2', # defect type - SFP2: sweep and fill <1m2, POT2 also seen + $defect_type, # defect type - SFP2: sweep and fill <1m2, POT2 also seen $report->response_priority ? $report->response_priority->external_id : "2", # priority of defect |