Announcement

  •  » Engine
  •  » [PWG Stuffs] "Recent pictures" module and order_by

#1 2010-09-11 22:35:18

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13573

[PWG Stuffs] "Recent pictures" module and order_by

Hi P@t,

Concerning [extension by plg] PWG Stuffs, I have a problem with the "Recent pictures" module because I have set:

Code:

$conf['order_by_inside_category'] = ' ORDER BY rank ASC, id ASC';

and on PWG_Stuffs/modules/Recent/main.inc.php :

Code:

SELECT DISTINCT(i.id)
  FROM images AS i
    INNER JOIN image_category AS ic ON i.id = ic.image_id
    INNER JOIN categories AS c ON ic.category_id = c.id
  WHERE i.date_available >= SUBDATE(
      CURRENT_DATE,INTERVAL 7 DAY)
    
     ORDER BY date_available DESC, rank ASC, id ASC
    LIMIT 0, 10
  ;

The "rank" is ambiguous (but "id" in the ORDER BY is not ambiguous, I don't understand why)

I don't understand why you don't just perform a:

Code:

ORDER BY id DESC

This would avoid the next:

Code:

  usort($pictures, 'rank_compare');

.

Offline

 

#2 2011-01-12 12:40:02

plg
Piwigo Team
Nantes, France, Europe
2002-04-05
13573

Re: [PWG Stuffs] "Recent pictures" module and order_by

bug fixed in [Subversion] r8625

Offline

 

#3 2011-01-12 17:37:31

P@t
Piwigo Team
Nice
2007-06-13
4098

Re: [PWG Stuffs] "Recent pictures" module and order_by

Thanks ;-)


P@t

Offline

 
  •  » Engine
  •  » [PWG Stuffs] "Recent pictures" module and order_by

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2022 · Contact