X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=Memories%2FTag.pm;h=744a98a089e49af7da5fff6192c99f4cf7865a7f;hb=01f2c0cb6a5be655072e5bdf519189b2305f9059;hp=1140185a307e45e07b328e919a463c9d4120c802;hpb=b9d021d4af1018ac2c60640678c1b790251190e9;p=memories.git diff --git a/Memories/Tag.pm b/Memories/Tag.pm index 1140185..744a98a 100644 --- a/Memories/Tag.pm +++ b/Memories/Tag.pm @@ -5,10 +5,9 @@ __PACKAGE__->columns(Essential => qw/id name/); Memories::Photo->set_sql(sorted_by_tag => q/ SELECT photo.id as id, title, uploader, uploaded, x, y -FROM photo, tag, tagging +FROM photo, tagging WHERE tagging.photo = photo.id - AND tagging.tag = tag.id - AND tag.id = ? + AND tagging.tag = ? ORDER BY photo.uploaded DESC / ); @@ -28,7 +27,7 @@ sub view :Exported { $sth->finish; $r->{template_args}{tags} = \@tags; } else { - if (!$r->objects) { + if (!@{$r->objects||[]}) { $tag = $tags[0]; } else { $tag = $r->objects->[0];