diff options
author | Matthew Somerville <matthew@mysociety.org> | 2015-08-17 17:12:26 +0100 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2015-08-19 15:47:20 +0100 |
commit | 5c79337ad423cd7fc3cada9b7830d90726387987 (patch) | |
tree | 61615747eae7483722bea4c94309ef4d1cddac4c /t/cobrand | |
parent | f5d6ec933c9fd4d57f9b56fec27f7c746a0706b9 (diff) |
Simplify/consolidate body restriction db code.
Make dashboard work properly in two-tier councils, showing reports sent
to both. Create an index on the array of the bodies_str column to speed
up performance, and use that throughout the code replacing all LIKE
scans. This also enables a simplifying tidy of the restriction code.
Diffstat (limited to 't/cobrand')
-rw-r--r-- | t/cobrand/two_tier.t | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/t/cobrand/two_tier.t b/t/cobrand/two_tier.t index ad664aabd..b3d6ca7db 100644 --- a/t/cobrand/two_tier.t +++ b/t/cobrand/two_tier.t @@ -6,11 +6,11 @@ use FixMyStreet; use FixMyStreet::Cobrand; my @cobrands = ( - [ hart => '%2333%' ], - [ oxfordshire => '%2237%' ], - [ eastsussex => '%2224%' ], - [ stevenage => '%2347%' ], - [ warwickshire => '%2243%' ], + [ hart => 2333 ], + [ oxfordshire => 2237 ], + [ eastsussex => 2224 ], + [ stevenage => 2347 ], + [ warwickshire => 2243 ], ); FixMyStreet::override_config { @@ -18,11 +18,10 @@ FixMyStreet::override_config { }, sub { for my $c (@cobrands) { - my ($m, $like) = @$c; + my ($m, $id) = @$c; my $cobrand = FixMyStreet::Cobrand->get_class_for_moniker($m); - my $problems_clause = $cobrand->problems_clause; - is_deeply $problems_clause, - { bodies_str => { like => $like } }, "problems_clause for $m"; + my $body_restriction = $cobrand->body_restriction; + is $body_restriction, $id, "body_restriction for $m"; } }; |