+ fix the generation of the lastopen list of files

This commit is contained in:
kelson42 2011-10-13 10:35:56 +00:00
parent aadce46adf
commit e33b448380
1 changed files with 30 additions and 27 deletions

View File

@ -452,34 +452,37 @@ namespace kiwix {
}
/* Special sort for LASTOPEN */
if (mode == LASTOPEN)
if (mode == LASTOPEN) {
std::sort(library.books.begin(), library.books.end(), kiwix::Book::sortByLastOpen);
/* Generate the list of book id */
for ( itr = library.books.begin(); itr != library.books.end(); ++itr ) {
bool ok = true;
if (mode == LOCAL && itr->path.empty())
ok = false;
if (mode == REMOTE && (!itr->path.empty() || itr->url.empty()))
ok = false;
if (mode == LASTOPEN && itr->last.empty())
ok = false;
if (atoi(itr->size.c_str()) > maxSize * 1024 * 1024)
ok = false;
if (!language.empty() && itr->language != language)
ok = false;
if (!publisher.empty() && itr->creator != publisher)
ok = false;
if (ok == true)
this->bookIdList.push_back(itr->id);
}
for ( itr = library.books.begin(); itr != library.books.end(); ++itr ) {
if (!itr->last.empty())
this->bookIdList.push_back(itr->id);
}
} else {
/* Generate the list of book id */
for ( itr = library.books.begin(); itr != library.books.end(); ++itr ) {
bool ok = true;
if (mode == LOCAL && itr->path.empty())
ok = false;
if (ok == true && mode == REMOTE && (!itr->path.empty() || itr->url.empty()))
ok = false;
if (ok == true && atoi(itr->size.c_str()) > maxSize * 1024 * 1024)
ok = false;
if (ok == true && !language.empty() && itr->language != language)
ok = false;
if (ok == true && !publisher.empty() && itr->creator != publisher)
ok = false;
if (ok == true) {
this->bookIdList.push_back(itr->id);
}
}
}
return true;
}