diff --git a/src/controller/buffers.py b/src/controller/buffers.py index 79de7c5..5739346 100644 --- a/src/controller/buffers.py +++ b/src/controller/buffers.py @@ -108,7 +108,7 @@ class baseBuffer(object): [self.insert(i) for i in self.session.db[self.name]["items"][:num]] else: if num > 0: - [self.insert(i, False) for i in self.session.db[self.name]["items"][:num]] + [self.insert(i, False) for i in self.session.db[self.name]["items"][-num:]] return retrieved def get_more_items(self): diff --git a/src/sessionmanager/session.py b/src/sessionmanager/session.py index aeaf378..19b8e2b 100644 --- a/src/sessionmanager/session.py +++ b/src/sessionmanager/session.py @@ -138,14 +138,12 @@ class vkSession(object): log.debug("Params for sending to vk: %r" % (kwargs,)) data = getattr(self.vk.client.newsfeed, "get")(*args, **kwargs) if data != None: - if show_nextpage == False: - self.process_usernames(data) -# else: -# print data.keys(), len(data["items"]), data["next_from"] + self.process_usernames(data) num = self.order_buffer(name, data["items"], show_nextpage) log.debug("Keys of the returned data for debug purposes: %r" % (list(data.keys()),)) if "next_from" in data: self.db[name]["cursor"] = data["next_from"] + log.debug("Next cursor saved for data: {cursor}".format(cursor=data["next_from"])) return num def get_page(self, name="", show_nextpage=False, endpoint="", *args, **kwargs):