Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Bricolage: users

Schwartzian transform sorting on a subelement field

 

 

Bricolage users RSS feed   Index | Next | Previous | View Threaded


acaul at rand

Feb 6, 2009, 8:44 AM

Post #1 of 2 (627 views)
Permalink
Schwartzian transform sorting on a subelement field

I am trying to use a Schwartzian transform to sort a bunch of stories
on a field that is within a subelement. Here is my code

my @related_stories =
map { $_->[0] }
sort { $b->[1] <=> $a->[1] }
map { [ $_, $_->get_element->get_container("subelement")->get_data
('subelement_date') => $_ ] }
$story->list({ element_key_name => "my_element", subelement_key_name
=> "subelement", category_uri => $burner->get_cat->get_uri,
publish_status => 1 });

foreach my $rs (@related_stories) {
$burner->display_element($rs->get_container("subelement"));
} # end foreach


This all works except for the sorting. The subelements display
properly but are not sorted according to the subelement_date field. I
think I'm a little off with my mapping, but I don't know it well
enough to see where. Can anyone see it? Thanks.

__________________________________________________________________________

This email message is for the sole use of the intended recipient(s) and
may contain confidential information. Any unauthorized review, use,
disclosure or distribution is prohibited. If you are not the intended
recipient, please contact the sender by reply email and destroy all copies
of the original message.


lannings at who

Feb 6, 2009, 9:01 AM

Post #2 of 2 (568 views)
Permalink
Re: Schwartzian transform sorting on a subelement field [In reply to]

On Fri, 6 Feb 2009, Ashlee Caul wrote:
> my @related_stories =
> map { $_->[0] }
> sort { $b->[1] <=> $a->[1] }

This sorts by number; is that what subelement_date is?
Use cmp to sort ABCly.

> map { [ $_,
> $_->get_element->get_container("subelement")->get_data('subelement_date') =>
> $_ ] }

"=> $_" is useless.

Bricolage users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.