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.

CommentFileSizeAuthor
#3 votingapi_limit_2.patch1.87 KBDeeLay
votingapi_limit.patch1.94 KBDeeLay

Comments

stewsnooze’s picture

+1
I haven't applied this locally but it looks good viewing the patch.

greggles’s picture

Status: Needs review » Needs work

Subscribe.

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);

DeeLay’s picture

StatusFileSize
new1.87 KB

Thanks for the feedback, implemented the suggestions and attached updated patch.

greggles’s picture

Status: Needs work » Needs review

Looks great to me - setting Status back to needs review since I don't think this needs any more work.

eaton’s picture

Status: Needs review » Fixed

committed to the dev version. looks good, thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.