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

Adding count property to queryiterator #1032

Merged
merged 4 commits into from
Jun 1, 2016
Merged

Adding count property to queryiterator #1032

merged 4 commits into from
Jun 1, 2016

Conversation

connorjburton
Copy link

@connorjburton connorjburton commented May 27, 2016

Ticket: #837
Reviewer: @jarednova

Issue

If you have a Timber\QueryIterator object, there is no way to get the total posts returned, for example of a search results page with the default posts object in context.

Solution

Add a method to return the private _query.post_count property

Impact

No impact

Usage

{{ QueryIteratorObject.post_count }}

Considerations

There may be other properties that would be useful to expose. Also I am not sure on the reason behind returning a QueryIterator rather than a collection of Timber\Posts, you could then do {{ posts | length }} to get the total posts

Testing

None

@connorjburton connorjburton added this to the v1.0.4 milestone May 27, 2016
@coveralls
Copy link

coveralls commented May 27, 2016

Coverage Status

Coverage decreased (-0.03%) to 88.212% when pulling 10a510b on cjb-iterator-count into 788919d on master.

@jarednova jarednova assigned lggorman and unassigned jarednova May 31, 2016
@jarednova
Copy link
Member

Thanks @connorjburton@lggorman, could you write a test to cover the new code?

@coveralls
Copy link

coveralls commented Jun 1, 2016

Coverage Status

Coverage decreased (-0.03%) to 88.223% when pulling 36331b0 on cjb-iterator-count into 8034b50 on master.

@lggorman
Copy link
Contributor

lggorman commented Jun 1, 2016

@jarednova sure thing

@coveralls
Copy link

coveralls commented Jun 1, 2016

Coverage Status

Coverage decreased (-0.03%) to 88.223% when pulling 79d89c4 on cjb-iterator-count into 8034b50 on master.

@coveralls
Copy link

coveralls commented Jun 1, 2016

Coverage Status

Coverage increased (+0.004%) to 88.223% when pulling 29dca3f on cjb-iterator-count into 0d21885 on master.

@lggorman lggorman merged commit 2bcacbe into master Jun 1, 2016
@connorjburton connorjburton deleted the cjb-iterator-count branch June 1, 2016 15:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants