Skip to content

Commit c11fff8

Browse files
committed
Fix bug in get_all_items
1 parent 9ee2bd4 commit c11fff8

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

vk_api/vk_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,4 @@ def get_all_items_slow(self, method, values=None, max_count=200):
7575
return {'count': len(items), 'items': items}
7676

7777
# Полный код в файле vk_procedures
78-
code_get_all_items = 'var z=%s,x=%s,y=%s,p={"count":z}+y,r=API.%s(p),c=r["count"],j=r["items"],o=z,i=1;while(i<25&&o+z<c){o=i*z+x;p={"count":z,"offset":o}+y;r=API.%s(p);j=j+r["items"];i=i+1;};return{"count":c,"items":j,"offset":o,"end":o+z>=c};'
78+
code_get_all_items = 'var z=%s,x=%s,y=%s,p={"count":z}+y,r=API.%s(p),c=r["count"],j=r["items"],o=z,i=1;while(i<25&&o<c){o=i*z+x;p={"count":z,"offset":o}+y;r=API.%s(p);j=j+r["items"];i=i+1;};return{"count":c,"items":j,"offset":o,"end":o+z>=c};'

vk_procedures

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ var items = res["items"];
1515
var offset = max_count;
1616

1717
var i = 1;
18-
while(i < 25 && offset + max_count < count) {
18+
while(i < 25 && offset < count) {
1919
offset = i * max_count + start_offset;
2020
params = {"count": max_count, "offset": offset};
2121
params = params + my_params;
@@ -26,5 +26,5 @@ while(i < 25 && offset + max_count < count) {
2626
i = i + 1;
2727
}
2828

29-
return {"count": count, "items": items, "offset": offset, "end": offset + max_count >= count};
29+
return {"count": count, "items": items, "offset": offset, "end": offset >= count};
3030
==========

0 commit comments

Comments
 (0)