diff options
author | Struan Donald <struan@exo.org.uk> | 2011-08-04 00:21:42 +0100 |
---|---|---|
committer | Struan Donald <struan@exo.org.uk> | 2011-08-04 00:21:42 +0100 |
commit | 3700dca455e552ff5846949b972f4be6cf7337dd (patch) | |
tree | 242cde5782ec45375337577caf943342838b8cdf /bin/open311-populate-service-list | |
parent | ce4d421f65f2f4df0abf07719cc5dc9320ea6ad1 (diff) |
yet another attempt at storing the service detail information
this time we sort as we store so we don't need to do this every time we
display the information
Diffstat (limited to 'bin/open311-populate-service-list')
-rwxr-xr-x | bin/open311-populate-service-list | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/bin/open311-populate-service-list b/bin/open311-populate-service-list index 2e65bf4fd..2a6733ef1 100755 --- a/bin/open311-populate-service-list +++ b/bin/open311-populate-service-list @@ -77,12 +77,14 @@ while ( my $council = $council_list->next ) { my $meta_data = $open311->get_service_meta_info( $service->{service_code} ); # turn the data into something a bit more friendly to use - my %meta = (); - foreach my $attribute ( @{ $meta_data->{attributes}->{attribute} } ) { - $meta{ $attribute->{code} } = $attribute; - } - - $contact->extra( \%meta ); + my @meta = + # remove trailing colon as we add this when we display so we don't want 2 + map { $_->{description} =~ s/:\s*//; $_ } + # there is a display order and we only want to sort once + sort { $a->{order} <=> $b->{order} } + @{ $meta_data->{attributes}->{attribute} }; + + $contact->extra( \@meta ); $contact->update; } |