add size filter.
This commit is contained in:
parent
303f89d345
commit
6f0b50218b
@ -213,14 +213,15 @@ std::list<VisitAnalysis> Database::mostViewedUrls(int size) {
|
|||||||
pv.url = reinterpret_cast<const char *>(sqlite3_column_text(stmt, 0));
|
pv.url = reinterpret_cast<const char *>(sqlite3_column_text(stmt, 0));
|
||||||
if (std::find(urlFilter.cbegin(), urlFilter.cend(), pv.url) != urlFilter.cend()) continue;
|
if (std::find(urlFilter.cbegin(), urlFilter.cend(), pv.url) != urlFilter.cend()) continue;
|
||||||
pv.pageViewCount = sqlite3_column_int(stmt, 1);
|
pv.pageViewCount = sqlite3_column_int(stmt, 1);
|
||||||
|
if (ret.size() < size) {
|
||||||
ret.push_back(pv);
|
ret.push_back(pv);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (rc != SQLITE_DONE) {
|
if (rc != SQLITE_DONE) {
|
||||||
LOG(error) << "Failed to execute statement: " << sqlite3_errmsg(m_sqlite3);
|
LOG(error) << "Failed to execute statement: " << sqlite3_errmsg(m_sqlite3);
|
||||||
}
|
}
|
||||||
sqlite3_finalize(stmt);
|
sqlite3_finalize(stmt);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,8 +252,10 @@ std::list<VisitAnalysis> Database::latestViewedUrls(int size) {
|
|||||||
visit.url = reinterpret_cast<const char *>(sqlite3_column_text(stmt, 0));
|
visit.url = reinterpret_cast<const char *>(sqlite3_column_text(stmt, 0));
|
||||||
if (std::find(urlFilter.cbegin(), urlFilter.cend(), visit.url) != urlFilter.cend()) continue;
|
if (std::find(urlFilter.cbegin(), urlFilter.cend(), visit.url) != urlFilter.cend()) continue;
|
||||||
visit.lastViewTime = sqlite3_column_int64(stmt, 1);
|
visit.lastViewTime = sqlite3_column_int64(stmt, 1);
|
||||||
|
if (ret.size() < size) {
|
||||||
ret.push_back(visit);
|
ret.push_back(visit);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user