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));
|
||||
if (std::find(urlFilter.cbegin(), urlFilter.cend(), pv.url) != urlFilter.cend()) continue;
|
||||
pv.pageViewCount = sqlite3_column_int(stmt, 1);
|
||||
ret.push_back(pv);
|
||||
if (ret.size() < size) {
|
||||
ret.push_back(pv);
|
||||
}
|
||||
}
|
||||
|
||||
if (rc != SQLITE_DONE) {
|
||||
LOG(error) << "Failed to execute statement: " << sqlite3_errmsg(m_sqlite3);
|
||||
}
|
||||
sqlite3_finalize(stmt);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -251,7 +252,9 @@ std::list<VisitAnalysis> Database::latestViewedUrls(int size) {
|
||||
visit.url = reinterpret_cast<const char *>(sqlite3_column_text(stmt, 0));
|
||||
if (std::find(urlFilter.cbegin(), urlFilter.cend(), visit.url) != urlFilter.cend()) continue;
|
||||
visit.lastViewTime = sqlite3_column_int64(stmt, 1);
|
||||
ret.push_back(visit);
|
||||
if (ret.size() < size) {
|
||||
ret.push_back(visit);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user