diff options
Diffstat (limited to 'bin/fixmystreet.com/fixture')
-rwxr-xr-x | bin/fixmystreet.com/fixture | 32 |
1 files changed, 27 insertions, 5 deletions
diff --git a/bin/fixmystreet.com/fixture b/bin/fixmystreet.com/fixture index 4a5bd3aed..8332bbe17 100755 --- a/bin/fixmystreet.com/fixture +++ b/bin/fixmystreet.com/fixture @@ -92,12 +92,34 @@ for my $cat ('Dropped Kerbs', 'Skips') { } if ($opt->test_fixtures) { - my $ncc = FixMyStreet::DB::Factory::Body->find_or_create({ - area_id => 2234, - categories => [ 'Fallen Tree' ], - name => 'Northamptonshire County Council', + my $bodies; + foreach ( + { area_id => 2234, categories => ['Fallen Tree'], name => 'Northamptonshire County Council' }, + { area_id => 2217, categories => ['Flytipping', 'Roads'], name => 'Buckinghamshire County Council' }, + { area_id => 2257, categories => ['Flytipping', 'Graffiti'], name => 'Chiltern District Council' }, + ) { + $bodies->{$_->{area_id}} = FixMyStreet::DB::Factory::Body->find_or_create($_); + my $cats = join(', ', @{$_->{categories}}); + say "Created body $_->{name} for MapIt area ID $_->{area_id}, categories $cats"; + } + + my $child_cat = FixMyStreet::DB->resultset("Contact")->find({ + body => $bodies->{2217}, + category => 'Flytipping', }); - say "Created body " . $ncc->name . " for MapIt area ID 2234, categories Fallen Tree"; + $child_cat->set_extra_fields({ + code => 'road-placement', + datatype => 'singlevaluelist', + description => 'Is the fly-tip located on', + order => 100, + required => 'true', + variable => 'true', + values => [ + { key => 'road', name => 'The road' }, + { key => 'off-road', name => 'Off the road/on a verge' }, + ], + }); + $child_cat->update; } FixMyStreet::DB::Factory::ResponseTemplate->create({ |