aboutsummaryrefslogtreecommitdiffstats
path: root/bin/open311-populate-service-list
diff options
context:
space:
mode:
Diffstat (limited to 'bin/open311-populate-service-list')
-rwxr-xr-xbin/open311-populate-service-list14
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;
}