diff options
author | Javier S. Pedro <maemo@javispedro.com> | 2013-04-07 00:59:24 +0200 |
---|---|---|
committer | Javier S. Pedro <maemo@javispedro.com> | 2013-04-07 00:59:24 +0200 |
commit | 1a66f6ee4f3806e2a18af718654e7281c7dd1066 (patch) | |
tree | 04aa1188b3e89611bc0492a49b1471260a2ca074 /fetchtopicsaction.cpp | |
parent | 81cfd7c483940c0672f35f91e088de9d7760fec1 (diff) | |
download | tapasboard-1a66f6ee4f3806e2a18af718654e7281c7dd1066.tar.gz tapasboard-1a66f6ee4f3806e2a18af718654e7281c7dd1066.zip |
fix some issues
Diffstat (limited to 'fetchtopicsaction.cpp')
-rw-r--r-- | fetchtopicsaction.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/fetchtopicsaction.cpp b/fetchtopicsaction.cpp index d8ea173..4617280 100644 --- a/fetchtopicsaction.cpp +++ b/fetchtopicsaction.cpp @@ -1,4 +1,5 @@ #include <QtCore/QDateTime> +#include <QtCore/QSet> #include <QtCore/QDebug> #include <QtSql/QSqlDatabase> #include <QtSql/QSqlQuery> @@ -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<int> current_topics = getCurrentDbTopics(_start, expected_end); - QList<int> unchanged_topics = current_topics; + int expected_end = _end == FetchAllTopics ? _start + MAX_FORUM_PAGE_SIZE - 1 : _end; + QSet<int> current_topics = QSet<int>::fromList(getCurrentDbTopics(_start, expected_end)); + QSet<int> 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) { |