diff options
-rwxr-xr-x | bin/fixmystreet.com/fixture | 9 | ||||
-rw-r--r-- | perllib/FixMyStreet/DB/Factories.pm | 25 |
2 files changed, 34 insertions, 0 deletions
diff --git a/bin/fixmystreet.com/fixture b/bin/fixmystreet.com/fixture index 9bb9435c5..d3b0a8349 100755 --- a/bin/fixmystreet.com/fixture +++ b/bin/fixmystreet.com/fixture @@ -67,6 +67,14 @@ my $body = FixMyStreet::DB::Factory::Body->find_or_create({ }); say "Created body " . $body->name . " for MapIt area ID " . $opt->area_id . ', categories ' . join(', ', @$categories); +FixMyStreet::DB::Factory::ResponseTemplate->create({ body => $body, title => 'Generic' }); +FixMyStreet::DB::Factory::ResponseTemplate->create({ body => $body, title => 'Fixed', state => 'fixed - council' }); +FixMyStreet::DB::Factory::ResponseTemplate->create({ body => $body, title => 'Monitoring', state => 'unable to fix' }); +my $template = FixMyStreet::DB::Factory::ResponseTemplate->create({ body => $body, title => 'Not us', state => 'not responsible' }); +$template->add_to_contacts($body->contacts->first); +my $priority = FixMyStreet::DB::Factory::ResponsePriority->create_batch(3, { body => $body }); +$priority->[0]->add_to_contacts($body->contacts->first); + # Users say "Created users, all with password 'password':"; my $user; # Will store the final (normal) user of the loop for later user @@ -123,6 +131,7 @@ for (1..$num) { my $titles = $titles{$category}; push @$problems, FixMyStreet::DB::Factory::Problem->create({ body => $body, + areas => ',' . $opt->area_id . ',', user => $user, postcode => $postcode->{postcode}, latitude => $postcode->{wgs84_lat} + rand($inaccurate_km) - $inaccurate_km / 2, diff --git a/perllib/FixMyStreet/DB/Factories.pm b/perllib/FixMyStreet/DB/Factories.pm index c3060507e..acf88063e 100644 --- a/perllib/FixMyStreet/DB/Factories.pm +++ b/perllib/FixMyStreet/DB/Factories.pm @@ -100,6 +100,31 @@ __PACKAGE__->fields({ ####################### +package FixMyStreet::DB::Factory::ResponseTemplate; + +use parent -norequire, "FixMyStreet::DB::Factory::Base"; + +__PACKAGE__->resultset(FixMyStreet::DB->resultset("ResponseTemplate")); + +__PACKAGE__->fields({ + text => __PACKAGE__->seq(sub { 'Template text #' . (shift()+1) }), +}); + +####################### + +package FixMyStreet::DB::Factory::ResponsePriority; + +use parent "DBIx::Class::Factory"; + +__PACKAGE__->resultset(FixMyStreet::DB->resultset("ResponsePriority")); + +__PACKAGE__->fields({ + name => __PACKAGE__->seq(sub { 'Priority #' . (shift()+1) }), + description => __PACKAGE__->seq(sub { 'Description #' . (shift()+1) }), +}); + +####################### + package FixMyStreet::DB::Factory::Comment; use parent "DBIx::Class::Factory"; |