diff options
author | Struan Donald <struan@exo.org.uk> | 2011-06-27 12:35:12 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2011-06-27 12:35:12 +0100 |
commit | 3d181cebab78ebe87242d4bb4a9afb48ca9aa524 (patch) | |
tree | e85b6dd08b2e264d0f46ce582d03cf68d31b9cef /perllib/FixMyStreet/DB/Result/User.pm | |
parent | a20fc533b0f10646814742f1348c5f9141217efa (diff) |
Display council name next to updates from council users
Diffstat (limited to 'perllib/FixMyStreet/DB/Result/User.pm')
-rw-r--r-- | perllib/FixMyStreet/DB/Result/User.pm | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/perllib/FixMyStreet/DB/Result/User.pm b/perllib/FixMyStreet/DB/Result/User.pm index ade8ca934..577d91c31 100644 --- a/perllib/FixMyStreet/DB/Result/User.pm +++ b/perllib/FixMyStreet/DB/Result/User.pm @@ -142,4 +142,21 @@ sub alert_for_problem { } ); } +sub council { + my $self = shift; + + return '' unless $self->from_council; + + my $key = 'council_name:' . $self->from_council; + my $result = Memcached::get($key); + + unless ($result) { + my $area_info = mySociety::MaPit::call('area', $self->from_council); + $result = $area_info->{name}; + Memcached::set($key, $result, 86400); + } + + return $result; +} + 1; |