Skip to content

Commit 30b5d41

Browse files
committed
When no maxItem info available on the site, we count nb of 'tr' in table
1 parent 756a7e1 commit 30b5d41

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/modules/global-parser/global-parser.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ function parserInit(cmdResponse) {
3333
*/
3434
async function getPagesLinks() {
3535
const $ = await request(requestOpts).catch(err => new errorHandler(err));
36-
const realMaxItem = Number($('div.ak-list-info > strong').text());
36+
// In order to prevent from empty value of realMaxItem when there is only 1 page
37+
const realMaxItem = Number($('div.ak-list-info > strong').text()) === 0 ? $('div.ak-container.ak-panel.main-object-list.ak-nocontentpadding tbody > tr').length : Number($('div.ak-list-info > strong').text());
3738
if (maxItem >= realMaxItem || all === true) maxItem = realMaxItem; // security line to avoid overpasing the real amont of items & to take care about 'all' value if true
3839

3940
const nbPageToParse = Math.ceil(maxItem / NB_ITEM_PER_PAGE);

0 commit comments

Comments
 (0)