From 1a66f6ee4f3806e2a18af718654e7281c7dd1066 Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Sun, 7 Apr 2013 00:59:24 +0200 Subject: fix some issues --- fetchtopicsaction.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'fetchtopicsaction.cpp') diff --git a/fetchtopicsaction.cpp b/fetchtopicsaction.cpp index d8ea173..4617280 100644 --- a/fetchtopicsaction.cpp +++ b/fetchtopicsaction.cpp @@ -1,4 +1,5 @@ #include +#include #include #include #include @@ -43,7 +44,7 @@ void FetchTopicsAction::execute() int end = _end; if (end == FetchAllTopics) { // Fetch topics in blocks of size 50. - end = _start + MAX_FORUM_PAGE_SIZE; + end = _start + MAX_FORUM_PAGE_SIZE - 1; // After finishing this action, a new one will be enqueued with the next 50. } @@ -63,9 +64,9 @@ void FetchTopicsAction::handleFinishedCall() db.transaction(); const int total_topic_num = map["total_topic_num"].toInt(); - int expected_end = _end == FetchAllTopics ? _start + MAX_FORUM_PAGE_SIZE : _end; - QList current_topics = getCurrentDbTopics(_start, expected_end); - QList unchanged_topics = current_topics; + int expected_end = _end == FetchAllTopics ? _start + MAX_FORUM_PAGE_SIZE - 1 : _end; + QSet current_topics = QSet::fromList(getCurrentDbTopics(_start, expected_end)); + QSet unchanged_topics = current_topics; if (_start >= total_topic_num) { // Workaround an issue where the service always returns one post. @@ -119,12 +120,9 @@ void FetchTopicsAction::handleFinishedCall() goto finish; } - unchanged_topics.removeOne(topic_id); + unchanged_topics.remove(topic_id); } - // "position" would now point to "_end + 1", if we had gotten as - // many topics as we requested. - int fetched_end = position - 1; bool eof = fetched_end < expected_end; if (eof) { -- cgit v1.2.3