Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.4] Category Item count takes publish dates into account #40172

Open
wants to merge 2 commits into
base: 4.4-dev
Choose a base branch
from

Conversation

hendrikbehncke
Copy link
Contributor

Summary of Changes

Item count on a category takes the publish_up and publish_down dates into account.

Actual result BEFORE applying this Pull Request

When setting a publish_down date in the past to unpublish an article the item count on a category will still count this article as published. And vice versa with a publish_up date in the future. The Categories view shows a different amount of articles than actually visible on the Category Blog view

Expected result AFTER applying this Pull Request

Categories view will show the exact number of articles published in a category.

Item count on a category takes the publish_up and publish_down dates into account.

## Actual result BEFORE applying this Pull Request
When setting a publish_down date in the past to unpublish an article the item count on a category will still count this article as published. And vice versa with  a publish_up date in the future.
The Categories view shows a different amount of articles than actually visible on the Category Blog view

## Expected result AFTER applying this Pull Request
Categories view will show the exact number of articles published in a category.
@richard67
Copy link
Member

richard67 commented Mar 30, 2023

Can we be really sure that all tables $this->_table used here

->from($db->quoteName($db->escape($this->_table), 'i'))
have publish_up and publish_down columns? If that table doesn't have these columns, we will get an SQL error about an unknown column when executing the SQL statement which is extended by this PR.

@Denitz
Copy link
Contributor

Denitz commented Mar 31, 2023

It will frustrate a user: you will see X published articles but if you click the red counter and navigate to article list with &filter[published]=0 filter you will see no articles because they are actually published (#__content.state = 1).

Not a good idea. Either skip it or implement a separate counter of smth like "currently unpublished" items.

@hendrikbehncke
Copy link
Contributor Author

Hi @richard67, that could indeed be an issue.
Maybe passing the fields in the options in components/com_content/src/Service/Category.php could solve this?

Or alternatively people use 3rd party plugins to automatically update the published flag depending on the publish_up and publish_down dates.

@Hackwar Hackwar added the bug label Apr 8, 2023
@HLeithner HLeithner changed the base branch from 4.3-dev to 4.4-dev September 30, 2023 22:44
@HLeithner
Copy link
Member

This pull request has been automatically rebased to 4.4-dev.

@HLeithner HLeithner changed the title Category Item count takes publish dates into account [4.4] Category Item count takes publish dates into account Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants