diff options
author | Matthew Somerville <matthew@mysociety.org> | 2014-02-25 12:41:50 +0000 |
---|---|---|
committer | Matthew Somerville <matthew@mysociety.org> | 2014-02-25 12:41:50 +0000 |
commit | 6ca1a7bb36b176b07572582c514f359d6176f8ac (patch) | |
tree | c27c030e57eec8dbb857c8165411c8299166fa35 | |
parent | cebc2d4fe88228a9864e737c9cdbdf94629f1554 (diff) |
Make sure bodies returned in consistent order.
-rw-r--r-- | perllib/FixMyStreet/DB/ResultSet/Problem.pm | 5 | ||||
-rw-r--r-- | t/app/model/problem.t | 4 |
2 files changed, 6 insertions, 3 deletions
diff --git a/perllib/FixMyStreet/DB/ResultSet/Problem.pm b/perllib/FixMyStreet/DB/ResultSet/Problem.pm index 3bf41035e..5499af474 100644 --- a/perllib/FixMyStreet/DB/ResultSet/Problem.pm +++ b/perllib/FixMyStreet/DB/ResultSet/Problem.pm @@ -340,7 +340,10 @@ sub send_reports { # XXX Only copes with at most one missing body my ($bodies, $missing) = $row->bodies_str =~ /^([\d,]+)(?:\|(\d+))?/; my @bodies = split(/,/, $bodies); - $bodies = FixMyStreet::App->model("DB::Body")->search({ id => \@bodies }); + $bodies = FixMyStreet::App->model("DB::Body")->search( + { id => \@bodies }, + { order_by => 'name' }, + ); $missing = FixMyStreet::App->model("DB::Body")->find($missing) if $missing; my @dear; diff --git a/t/app/model/problem.t b/t/app/model/problem.t index 7303eedac..fa8cf89ae 100644 --- a/t/app/model/problem.t +++ b/t/app/model/problem.t @@ -465,8 +465,8 @@ foreach my $test ( { desc => 'email to two tier council', unset_whendef => 1, email_count => 1, - to => qr'Gloucestershire County Council.*Cheltenham Borough Council', - dear => qr'Dear Gloucestershire County Council and Cheltenham Borough', + to => qr'Cheltenham Borough Council.*Gloucestershire County Council', + dear => qr'Dear Cheltenham Borough Council and Gloucestershire County', body => '2226,2326', multiple => 1, }, { |