<% my $constructs; %> <% if ($contents_search) { %> <% $constructs = &subs::db_query('select distinct(app) as app,* from settings where (setting = ? or setting=?) and device=? and app like ?','pos', 'mab', &subs::device_setter(), '%' . $contents_search . '%')->hashes; %> <% } else { %> <% $constructs = &subs::db_query('select distinct(app) as app,* from settings where (setting = ? or setting=?) and value=? and device=?','pos', 'mab', $settings->{'construct'}, &subs::device_setter())->hashes; %> <% } %> <% my $cd = &subs::cache_get({ app => 'relational', context => 'buckets' }); <% my $c = app->build_controller; %> <% my $new_count = 0; %> <% my $seen = []; %> <% foreach my $const ( sort { $a->{'app'} cmp $b->{'app'} } @{$constructs} ) { %> <% next if grep { $const->{'app'} eq $_ } @{$seen}; push @{$seen}, $const->{'app'}; %> <% if ($cd->{$const->{'app'}}) { %> <%== $cd->{$const->{'app'}} %> <% } else { $new_count++; $cd->{$const->{'app'}} = $c->render_to_string( template => 'relational/bucket', const => $const, all_settings => $all_settings, settings => $settings ); %> <%= $cd->{$const->{'app'}} %> <% } %> <% } %> <% &subs::cache_set({ app => 'relational', context => 'buckets', warranty => '-5y' }, $cd) if $new_count > 0; %>