Fix for #332: adjacent items for unsorted connections#370
Fix for #332: adjacent items for unsorted connections#370Oreolek wants to merge 6 commits intoscribu:masterfrom Oreolek:master
Conversation
|
Please describe your solution in a few words (it's not very clear by looking at the diff). |
|
A single loop of all relatives. They are already sorted by WP, so it's looking for current object. |
core/connection-type.php
Outdated
There was a problem hiding this comment.
This will only fetch the first 10 connections, so it will return incorrect results if there are more than 10 items in a series.
There was a problem hiding this comment.
You could replace array() with array( 'p2p:per_page' => -1 ).
There was a problem hiding this comment.
So this revision is safe to use right?
|
Ok, the diff looks decent now. I would like to see a unit test for this in |
|
Erm... the instructions for running the unit tests are incomplete. I'll update them soon. Even so, they probably don't work on Windows, unless you have Cygwin. However, you can try to commit a first draft and push it to the branch; it'll get run by the build server (Travis CI). |
|
There: https://github.com/scribu/wp-posts-to-posts/blob/master/CONTRIBUTING.md#unit-tests You'll need to switch to the latest master branch (3e55425) to see the |
|
It says the following: "Good to merge — The Travis CI build passed (Details)" Does this mean that everything is handled and it'll be in the normal posts-to-posts plugin soon? |
|
The "The Travis CI build passed" message just means that the current patch passes all existing unit tests. If you want to help, you can start using Oreolek's fork and report back any problems you find. |
|
Alright cool! Thanks. But by looking at the code you think it's safe to use right? |
|
It's safe in the sense that it won't delete your connections or anything like that. :P I have no idea if it fetches the correct posts, what happens if you have many posts etc. That's why I'm asking you to try it out, since you already have a use-case for it. |
|
I'm testing it right now :) It seems to work pretty great. |
|
Tested with the same code that you gave me before @scribu without turning sorting on it seems to work perfectly. Seems to work with 600+ connections. http://phanime.com/anime/one-piece/ ^ Click on one of the episodes (out of 600) and you can go next and previous. Seems to work pretty great :) |
Not as fast as default behaviour, but still.
#332