?
Referenced as Pull Request for: # 9376
avatar vitaly80
vitaly80
9 Mar 2016

Steps to reproduce the issue

Create some materials with tags. Create module and sort by title.

Expected result

Most Pupular Articles, limit by Maximum and then sort by title

Actual result

Sort by title, limit by Maximum.

System information (as much as possible)

Additional comments

Truly the most popular articles are not subject to sampling.

avatar vitaly80 vitaly80 - open - 9 Mar 2016
avatar brianteeman
brianteeman - comment - 9 Mar 2016

The title that is displayed is the title of the tag not the article

On 9 March 2016 at 16:01, vitaly80 notifications@github.com wrote:

Steps to reproduce the issue

Create some materials with tags. Create module and sort by title.
Expected result

Most Pupular Articles, limit by Maximum and then sort by title
Actual result

Sort by title, limit by Maximum.
System information (as much as possible) Additional comments

Truly the most popular articles are not subject to sampling.


Reply to this email directly or view it on GitHub
#9351.

Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/

avatar brianteeman
brianteeman - comment - 9 Mar 2016

As far as I can see this is working exactly as it is designed to work
The module displays a list of the most popular tags and sorts them depending on the settings in the module


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9351.

avatar vitaly80
vitaly80 - comment - 9 Mar 2016

example:

tag | count
fauna | 5
flora | 4
nature | 2
oceans | 30

In module we want to see 3 most popular item, sorting by title.

Expecting:
fauna, flora, oceans ("slice" 3 most popular, and then sort by the title)

Actual Result:

fauna, flora, nature (sort by title, and then slice 3). MOST POPULAR TAG ON THE SITE "OCEANS" NOT SHOWING!


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9351.

avatar brianteeman brianteeman - change - 9 Mar 2016
Status New Confirmed
avatar brianteeman
brianteeman - comment - 9 Mar 2016

I see what you mean now. It is not working as a "popular" tag list at all - just as a list of tags

I will see if I can fix that in the morning


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9351.

avatar brianteeman
brianteeman - comment - 9 Mar 2016

Looking at the code it is completely missing any "order by count" which stops it from ever being a "popular" tags module

Unlike the "popular articles" module which does have it as seen here https://github.com/joomla/joomla-cms/blob/staging/modules/mod_articles_popular/helper.php#L73

@alikon your sql is far better than mine - any idea of the best way to do it for this module


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9351.

avatar vitaly80
vitaly80 - comment - 9 Mar 2016

module works fine if sort by count, descending. but in cloud expecting, that displaying sort by title.

https://github.com/joomla/joomla-cms/blob/staging/modules/mod_tags_popular/helper.php it is not 3.4.8... and also not working as expecting.

lets see at
https://github.com/joomla/joomla-cms/blob/staging/modules/mod_tags_popular/helper.php#L84

$query->order($order_value . ' ' . $order_direction);

expecting, i think should be:

$query->order('count DESC');

then
...

$db->setQuery($query, 0, $maximum);
...
$results = $db->loadObjectList();

...

I think that after this should be manual processing of $results(sorting by title, etc.)

Sorry for my worst English


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9351.

avatar brianteeman
brianteeman - comment - 9 Mar 2016

I agree

avatar SharkyKZ
SharkyKZ - comment - 10 Mar 2016

It works as expected, module name might be confusing. It's the default module for displaying tags. Ordering options are separate as stated in module description. It is a "popular tags" module when item count is used for ordering. When ordering by title, only title is meant to be taken into consideration to achieve alphabetical ordering. Example above would break the count direction (least popular tags wouldn't work) and alphabetical ordering.

avatar alikon
alikon - comment - 10 Mar 2016

@vitaly80 good catch
@brianteeman from a quick look we have this staging query under the issue conditions


SELECT MAX(tag_id) AS tag_id, COUNT(*) AS count,MAX(t.title) AS title,MAX(t.access) AS access,MAX(t.alias) AS alias
FROM j35b2_contentitem_tag_map AS m
INNER JOIN j35b2_tags AS t ON tag_id = t.id
INNER JOIN j35b2_ucm_content AS c ON m.core_content_id = c.core_content_id
WHERE t.access IN (1,1,5) AND t.published = 1
AND m.type_alias = c.core_type_alias
AND c.core_state = 1
AND (c.core_publish_up = 0000-00-00 00:00:00 OR c.core_publish_up <= '2016-03-10 06:28:01')
AND (c.core_publish_down = '0000-00-00 00:00:00' OR c.core_publish_down >= '2016-03-10 06:28:01')
GROUP BY tag_id,title,access,alias
ORDER BY count DESC LIMIT 0, 3

lets call this query queryA
what we need to do is simply


select a.tag_id, a.count, a.title, a.access, a.alias
from (queryA) A
order by a.title DESC

`i'll sumbit a pr in the weekend

avatar brianteeman
brianteeman - comment - 10 Mar 2016

If it is called popular tags module - then it is not working as expected
If it is called tags modules - then it is working as expected

Either way either the code or the text needs changing/fixing

On 10 March 2016 at 06:54, SharkyKZ notifications@github.com wrote:

It works as expected, module name might be confusing. It's the default
module for displaying tags. Ordering options are separate as stated in
module description. It is a "popular tags" module when item count is used
for ordering. When ordering by title, only title is meant to be taken into
consideration. Example above would break the count direction (least popular
tags wouldn't work) and alphabetical ordering.


Reply to this email directly or view it on GitHub
#9351 (comment).

Brian Teeman
Co-founder Joomla! and OpenSourceMatters Inc.
http://brian.teeman.net/

avatar brianteeman
brianteeman - comment - 10 Mar 2016

Thanks @alikon - looks like the correct path to me - and far better than
the hack I was looking at ;)

avatar SharkyKZ
SharkyKZ - comment - 10 Mar 2016

It is working as a popular tags module when item count ordering and asc direction is selected. Or unpopular tags module when disc direction is selected. Or alphabetical when title ordering is selected. Etc. Forcing to select by count/desc would break this multifunctionality. A simple solution would be to add additional params to separately control display order. This would simply add another order query after the first one.

avatar brianteeman
brianteeman - comment - 10 Mar 2016

If there is no change in functionality then it cannot be called "popular
tags"

avatar alikon alikon - reference | 28eeb62 - 11 Mar 16
avatar brianteeman brianteeman - change - 11 Mar 2016
Status Confirmed Closed
Closed_Date 0000-00-00 00:00:00 2016-03-11 17:34:58
Closed_By brianteeman
avatar brianteeman brianteeman - close - 11 Mar 2016
avatar brianteeman brianteeman - close - 11 Mar 2016
avatar brianteeman
brianteeman - comment - 11 Mar 2016

Closing as we have a PR for testing - #9376
@vitaly80 please test this


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/9351.

avatar vitaly80
vitaly80 - comment - 11 Mar 2016

OK! Now works fine! Thanks @brianteeman , thanks @alikon !

avatar brianteeman
brianteeman - comment - 11 Mar 2016

@vitaly80 please can you record a successful test https://issues.joomla.org/tracker/joomla-cms/9376

avatar vitaly80
vitaly80 - comment - 11 Mar 2016

Now testing many times, works perfect, but if enable "random" option - get error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 0, 2' at line 7 SQL=SELECT MAX(tag_id) AS tag_id, COUNT(*) AS count,MAX(t.title) AS title,MAX(t.access) AS access,MAX(t.alias) AS alias FROM zwdj7_contentitem_tag_map AS m INNER JOIN zwdj7_tags AS t ON tag_id = t.id INNER JOIN zwdj7_ucm_content AS c ON m.core_content_id = c.core_content_id WHERE t.access IN (1,1,5) AND t.published = 1 AND m.type_alias = c.core_type_alias AND c.core_state = 1 AND (c.core_publish_up = '0000-00-00 00:00:00' OR c.core_publish_up <= '2016-03-11 23:21:18') AND (c.core_publish_down = '0000-00-00 00:00:00' OR c.core_publish_down >= '2016-03-11 23:21:18') GROUP BY tag_id,title,access,alias ORDER BY LIMIT 0, 2

avatar vitaly80
vitaly80 - comment - 11 Mar 2016

for me it successful) but for all cases - not(

avatar vitaly80
vitaly80 - comment - 12 Mar 2016

$query->order('rand()');

works perfect!)

avatar vitaly80
vitaly80 - comment - 12 Mar 2016

on 3.5 works fine.

Add a Comment

Login with GitHub to post a comment