Sorting of articles in "Author Details" page is impredicible

Hi,
I’m working on OJS 2.4.8 with DB on PostgreSQL.
If I go inside the list of articles done by an author, the sort of article is impredicible.
To arrive:
Browse → By Author->Author name.
An live example:
http://symphonya.unimib.it/search/authors/view?firstName=Silvio%20M.&middleName=&lastName=Brondoni&affiliation=&country=

I think the problem is in the code that do extraction of articles, the function getPublishedArticlesForAuthor inside
classes/article/AuthorDAO.inc.php.
The relevant code is:

 $params = array(
                        'affiliation',
                        $firstName, $middleName, $lastName,
                        $affiliation, $country
                );
                if ($journalId !== null) $params[] = (int) $journalId;

                $result =& $this->retrieve(
                        'SELECT DISTINCT
                                aa.submission_id
                        FROM    authors aa
                                LEFT JOIN articles a ON (aa.submission_id = a.article_id)
                                LEFT JOIN author_settings asl ON (asl.author_id = aa.author_id AND asl.setting_name = ?)
                        WHERE   aa.first_name = ?
                                AND a.status = ' . STATUS_PUBLISHED . '
                                AND (aa.middle_name = ?' . (empty($middleName)?' OR aa.middle_name IS NULL':'') . ')
                                AND aa.last_name = ?
                                AND (asl.setting_value = ?' . (empty($affiliation)?' OR asl.setting_value IS NULL':'') . ')
                                AND (aa.country = ?' . (empty($country)?' OR aa.country IS NULL':'') . ') ' .
                                ($journalId!==null?(' AND a.journal_id = ?'):''),
                        $params
                );

There isn’t a sort inside those SQL.
In MySQL with InnoDB table there is a default on primary key of the table [a.article_id I think],
see: http://stackoverflow.com/questions/8746519/sql-what-is-the-default-order-by-of-queries

In PostgreSQL no default at all

It is possible to add an explicit sort by article id ?
So for MySQL installations nothing change, and for PostgreSQL we have an order.

Bye
Zeno Tajoli

Hi @ztajoli,

Yes, I think it would be appropriate to add a sort – but why the article ID? I think off the top of my head that users might expect an alphabetical listing by title.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi,

in fact an alphabetical listing by title, but it is a change of present
situation on MySQL default setup.
For my users (on PostgreSQL) it is OK, probably they prefer as solution
an alphabetical listing by title.

Hi @ztajoli,

I doubt anyone will mind a change of ordering if they’re using MySQL, as the current ordering doesn’t provide useful information to the user. In any case, you can get a “sorting title” from the article_settings table by looking for the entries with setting_value='cleanTitle'.

Regards,
Alec Smecher
Public Knowledge Project Team