From dc26215a3a831d940f8590c9d1f359e7f2c27e68 Mon Sep 17 00:00:00 2001 From: Paul Joseph Davis Date: Fri, 14 Aug 2009 15:17:23 +0000 Subject: Fixes COUCHDB-429 - Error durring paging. Patch by Jason Davies git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@804255 13f79535-47bb-0310-9956-ffa450edef68 --- share/www/script/futon.browse.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'share/www/script') diff --git a/share/www/script/futon.browse.js b/share/www/script/futon.browse.js index 7fa880fd..5a8b3fa7 100644 --- a/share/www/script/futon.browse.js +++ b/share/www/script/futon.browse.js @@ -509,10 +509,13 @@ resp.offset = 0; } var descending_reverse = ((options.descending && !descend) || (descend && (options.descending === false))); + var has_reduce_prev = resp.total_rows === undefined && (descending_reverse ? resp.rows.length > per_page : options.startkey !== undefined); if (descending_reverse && resp.rows) { resp.rows = resp.rows.reverse(); + if (resp.rows.length > per_page) { + resp.rows.push(resp.rows.shift()); + } } - var has_reduce_prev = resp.total_rows === undefined && (descending_reverse ? resp.rows.length > per_page : options.startkey !== undefined); if (resp.rows !== null && (has_reduce_prev || (descending_reverse ? (resp.total_rows - resp.offset > per_page) : (resp.offset > 0)))) { -- cgit v1.2.3