The _votingapi_select function takes a $limit argument, but none of the public functions use it. The patch exposes the $limit argument through votingapi_select_votes and votingapi_select_results to allow the maximum number of votes returned to be specified.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | votingapi_limit_2.patch | 1.87 KB | DeeLay |
| votingapi_limit.patch | 1.94 KB | DeeLay |
Comments
Comment #1
stewsnooze+1
I haven't applied this locally but it looks good viewing the patch.
Comment #2
gregglesSubscribe.
The new comments could be improved:
"integer specifying the maximum number of votes to return" vs. "An optional integer specifying the maximum number of votes to return."
I'm also not sure about
$result = $limit ? _votingapi_select('vote', $criteria, $limit) : _votingapi_select('vote', $criteria);Since _votingapi_select defaults $limit to 0 itself and handles that as a special case I think it would be OK to call _votingapi_select with the $limit always:
$result = _votingapi_select('vote', $criteria, $limit);Comment #3
DeeLay commentedThanks for the feedback, implemented the suggestions and attached updated patch.
Comment #4
gregglesLooks great to me - setting Status back to needs review since I don't think this needs any more work.
Comment #5
eaton commentedcommitted to the dev version. looks good, thanks!