aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/fixmystreet.com/fixture23
-rw-r--r--perllib/FixMyStreet/DB/Factories.pm3
-rw-r--r--t/images/12049724866_404b066875_z.jpgbin0 -> 144831 bytes
-rw-r--r--t/images/12205918375_f37f0b27a9_z.jpgbin0 -> 152674 bytes
-rw-r--r--t/images/14347396807_20737504f7_z.jpgbin0 -> 169141 bytes
-rw-r--r--t/images/14792525771_167bc20e3d_z.jpgbin0 -> 106463 bytes
-rw-r--r--t/images/19119222668_a3c866d7c8_z.jpgbin0 -> 127230 bytes
-rw-r--r--t/images/20515339175_f4ed9fc1d9_z.jpgbin0 -> 105014 bytes
-rw-r--r--t/images/22593395257_3d48f23bfa_z.jpgbin0 -> 212973 bytes
-rw-r--r--t/images/22998854352_17555b7536_z.jpgbin0 -> 96995 bytes
-rw-r--r--t/images/23222004240_273977b2b2_z.jpgbin0 -> 136915 bytes
-rw-r--r--t/images/27050321819_ac123400eb_z.jpgbin0 -> 158859 bytes
-rw-r--r--t/images/31889115854_01cdf38b0d_z.jpgbin0 -> 71055 bytes
-rw-r--r--t/images/33717571655_46dfc6f65f_z.jpgbin0 -> 214007 bytes
-rw-r--r--t/images/35732107202_b790c61f63_z.jpgbin0 -> 122716 bytes
-rw-r--r--t/images/36296226976_a83a118ff8_z.jpgbin0 -> 197974 bytes
-rw-r--r--t/images/3705226606_eac71cf195_z.jpgbin0 -> 90645 bytes
-rw-r--r--t/images/37855543925_9dbbbecf41_z.jpgbin0 -> 82708 bytes
-rw-r--r--t/images/38110448864_fd71227247_z.jpgbin0 -> 109570 bytes
-rw-r--r--t/images/6304445383_bd216ca892_z.jpgbin0 -> 199228 bytes
-rw-r--r--t/images/8895442578_376a9b0be0_z.jpgbin0 -> 127203 bytes
21 files changed, 25 insertions, 1 deletions
diff --git a/bin/fixmystreet.com/fixture b/bin/fixmystreet.com/fixture
index 194bdc48c..78f96f235 100755
--- a/bin/fixmystreet.com/fixture
+++ b/bin/fixmystreet.com/fixture
@@ -16,9 +16,11 @@ BEGIN {
}
use List::Util qw(shuffle);
+use Path::Tiny;
use FixMyStreet;
use FixMyStreet::Cobrand;
use FixMyStreet::DB::Factories;
+use FixMyStreet::App::Model::Photoset;
use DateTime::Format::Pg;
use Getopt::Long::Descriptive;
@@ -123,6 +125,12 @@ my %titles = (
'Graffiti' => ['Graffiti', 'Graffiti', 'Offensive graffiti', 'Graffiti on the bridge', 'Remove graffiti'],
'Other' => ['Loose drain cover', 'Flytipping on country lane', 'Vehicle blocking footpath', 'Hedge encroaching pavement', 'Full litter bins'],
);
+my %photos = (
+ 'Potholes' => [ '33717571655_46dfc6f65f_z.jpg', '37855543925_9dbbbecf41_z.jpg', '19119222668_a3c866d7c8_z.jpg', '12049724866_404b066875_z.jpg', '3705226606_eac71cf195_z.jpg', '6304445383_bd216ca892_z.jpg' ],
+ 'Street lighting' => ['38110448864_fd71227247_z.jpg', '27050321819_ac123400eb_z.jpg', '35732107202_b790c61f63_z.jpg', '31889115854_01cdf38b0d_z.jpg', undef ],
+ 'Graffiti' => ['12205918375_f37f0b27a9_z.jpg', '8895442578_376a9b0be0_z.jpg', '22998854352_17555b7536_z.jpg', '22593395257_3d48f23bfa_z.jpg', '20515339175_f4ed9fc1d9_z.jpg' ],
+ 'Other' => ['14347396807_20737504f7_z.jpg', '14792525771_167bc20e3d_z.jpg', undef, '36296226976_a83a118ff8_z.jpg', '23222004240_273977b2b2_z.jpg'],
+);
my %descriptions = (
'Potholes' => [
'6” deep pothole in the very centre of the Bristol road; cars are swerving to avoid it. Please treat this as a matter of urgency.',
@@ -186,6 +194,20 @@ for (1..$num) {
my $titles = $titles{$category};
my $descs = $descriptions{$category};
my $rand = int(rand(@$titles));
+
+ my $photo;
+ if (my $file = $photos{$category}->[$rand]) {
+ my $files = [ $file ];
+ if ($category eq 'Graffiti') {
+ push @$files, $photos{$category}->[int(rand(@$titles))];
+ }
+ $files = [ map { path(FixMyStreet->path_to("t/images/$_"))->slurp_raw } @$files ];
+ my $photoset = FixMyStreet::App::Model::PhotoSet->new({
+ data_items => $files,
+ });
+ $photo = $photoset->data;
+ }
+
push @$problems, FixMyStreet::DB::Factory::Problem->create({
body => $body,
areas => ',' . $opt->area_id . ',',
@@ -197,6 +219,7 @@ for (1..$num) {
cobrand => $cobrand,
title => $titles->[$rand],
detail => $descs->[$rand],
+ photo_id => $photo,
confirmed => DateTime::Format::Pg->format_datetime($confirmed),
});
}
diff --git a/perllib/FixMyStreet/DB/Factories.pm b/perllib/FixMyStreet/DB/Factories.pm
index 7b8234aec..0e99608e1 100644
--- a/perllib/FixMyStreet/DB/Factories.pm
+++ b/perllib/FixMyStreet/DB/Factories.pm
@@ -22,7 +22,7 @@ use parent "DBIx::Class::Factory";
__PACKAGE__->resultset(FixMyStreet::DB->resultset("Problem"));
-__PACKAGE__->exclude(['body']);
+__PACKAGE__->exclude(['body', 'photo_id']);
__PACKAGE__->fields({
postcode => '',
@@ -30,6 +30,7 @@ __PACKAGE__->fields({
detail => __PACKAGE__->seq(sub { 'Detail #' . (shift()+1) }),
name => __PACKAGE__->callback(sub { shift->get('user')->name }),
bodies_str => __PACKAGE__->callback(sub { shift->get('body')->id }),
+ photo => __PACKAGE__->callback(sub { shift->get('photo_id') }),
confirmed => \'current_timestamp',
whensent => \'current_timestamp',
state => 'confirmed',
diff --git a/t/images/12049724866_404b066875_z.jpg b/t/images/12049724866_404b066875_z.jpg
new file mode 100644
index 000000000..42de32674
--- /dev/null
+++ b/t/images/12049724866_404b066875_z.jpg
Binary files differ
diff --git a/t/images/12205918375_f37f0b27a9_z.jpg b/t/images/12205918375_f37f0b27a9_z.jpg
new file mode 100644
index 000000000..6b0c8637d
--- /dev/null
+++ b/t/images/12205918375_f37f0b27a9_z.jpg
Binary files differ
diff --git a/t/images/14347396807_20737504f7_z.jpg b/t/images/14347396807_20737504f7_z.jpg
new file mode 100644
index 000000000..820382985
--- /dev/null
+++ b/t/images/14347396807_20737504f7_z.jpg
Binary files differ
diff --git a/t/images/14792525771_167bc20e3d_z.jpg b/t/images/14792525771_167bc20e3d_z.jpg
new file mode 100644
index 000000000..a52d134a0
--- /dev/null
+++ b/t/images/14792525771_167bc20e3d_z.jpg
Binary files differ
diff --git a/t/images/19119222668_a3c866d7c8_z.jpg b/t/images/19119222668_a3c866d7c8_z.jpg
new file mode 100644
index 000000000..48ec0102b
--- /dev/null
+++ b/t/images/19119222668_a3c866d7c8_z.jpg
Binary files differ
diff --git a/t/images/20515339175_f4ed9fc1d9_z.jpg b/t/images/20515339175_f4ed9fc1d9_z.jpg
new file mode 100644
index 000000000..9b70bb6fc
--- /dev/null
+++ b/t/images/20515339175_f4ed9fc1d9_z.jpg
Binary files differ
diff --git a/t/images/22593395257_3d48f23bfa_z.jpg b/t/images/22593395257_3d48f23bfa_z.jpg
new file mode 100644
index 000000000..e297e460c
--- /dev/null
+++ b/t/images/22593395257_3d48f23bfa_z.jpg
Binary files differ
diff --git a/t/images/22998854352_17555b7536_z.jpg b/t/images/22998854352_17555b7536_z.jpg
new file mode 100644
index 000000000..f754806d2
--- /dev/null
+++ b/t/images/22998854352_17555b7536_z.jpg
Binary files differ
diff --git a/t/images/23222004240_273977b2b2_z.jpg b/t/images/23222004240_273977b2b2_z.jpg
new file mode 100644
index 000000000..952cea966
--- /dev/null
+++ b/t/images/23222004240_273977b2b2_z.jpg
Binary files differ
diff --git a/t/images/27050321819_ac123400eb_z.jpg b/t/images/27050321819_ac123400eb_z.jpg
new file mode 100644
index 000000000..3b16ac4c2
--- /dev/null
+++ b/t/images/27050321819_ac123400eb_z.jpg
Binary files differ
diff --git a/t/images/31889115854_01cdf38b0d_z.jpg b/t/images/31889115854_01cdf38b0d_z.jpg
new file mode 100644
index 000000000..8a20014db
--- /dev/null
+++ b/t/images/31889115854_01cdf38b0d_z.jpg
Binary files differ
diff --git a/t/images/33717571655_46dfc6f65f_z.jpg b/t/images/33717571655_46dfc6f65f_z.jpg
new file mode 100644
index 000000000..839206b95
--- /dev/null
+++ b/t/images/33717571655_46dfc6f65f_z.jpg
Binary files differ
diff --git a/t/images/35732107202_b790c61f63_z.jpg b/t/images/35732107202_b790c61f63_z.jpg
new file mode 100644
index 000000000..ae514d465
--- /dev/null
+++ b/t/images/35732107202_b790c61f63_z.jpg
Binary files differ
diff --git a/t/images/36296226976_a83a118ff8_z.jpg b/t/images/36296226976_a83a118ff8_z.jpg
new file mode 100644
index 000000000..63285ea62
--- /dev/null
+++ b/t/images/36296226976_a83a118ff8_z.jpg
Binary files differ
diff --git a/t/images/3705226606_eac71cf195_z.jpg b/t/images/3705226606_eac71cf195_z.jpg
new file mode 100644
index 000000000..3c07dceb4
--- /dev/null
+++ b/t/images/3705226606_eac71cf195_z.jpg
Binary files differ
diff --git a/t/images/37855543925_9dbbbecf41_z.jpg b/t/images/37855543925_9dbbbecf41_z.jpg
new file mode 100644
index 000000000..510586516
--- /dev/null
+++ b/t/images/37855543925_9dbbbecf41_z.jpg
Binary files differ
diff --git a/t/images/38110448864_fd71227247_z.jpg b/t/images/38110448864_fd71227247_z.jpg
new file mode 100644
index 000000000..832b2c6f8
--- /dev/null
+++ b/t/images/38110448864_fd71227247_z.jpg
Binary files differ
diff --git a/t/images/6304445383_bd216ca892_z.jpg b/t/images/6304445383_bd216ca892_z.jpg
new file mode 100644
index 000000000..dccfe13da
--- /dev/null
+++ b/t/images/6304445383_bd216ca892_z.jpg
Binary files differ
diff --git a/t/images/8895442578_376a9b0be0_z.jpg b/t/images/8895442578_376a9b0be0_z.jpg
new file mode 100644
index 000000000..b27437bac
--- /dev/null
+++ b/t/images/8895442578_376a9b0be0_z.jpg
Binary files differ