mirror of
https://github.com/YACReader/yacreader
synced 2025-05-28 03:10:27 -04:00
Fix json produced by the search controller
This commit is contained in:
parent
1a0b9da8d7
commit
d6b1c68285
@ -47,7 +47,7 @@ void SearchController::serviceSearch(int libraryId, const QString &query, stefan
|
|||||||
|
|
||||||
// comics
|
// comics
|
||||||
try {
|
try {
|
||||||
auto sqlQuery = foldersSearchQuery(db, query);
|
auto sqlQuery = comicsSearchQuery(db, query);
|
||||||
getComics(libraryId, sqlQuery, results);
|
getComics(libraryId, sqlQuery, results);
|
||||||
} catch (const std::exception &e) {
|
} catch (const std::exception &e) {
|
||||||
}
|
}
|
||||||
@ -71,7 +71,7 @@ void SearchController::getFolders(int libraryId, QSqlQuery &sqlQuery, QJsonArray
|
|||||||
folder["library_id"] = QString::number(libraryId);
|
folder["library_id"] = QString::number(libraryId);
|
||||||
folder["folder_name"] = sqlQuery.value("name").toString();
|
folder["folder_name"] = sqlQuery.value("name").toString();
|
||||||
folder["num_children"] = sqlQuery.value("numChildren").toInt();
|
folder["num_children"] = sqlQuery.value("numChildren").toInt();
|
||||||
folder["first_comic_hash"] = sqlQuery.value("firstChildHash").toInt();
|
folder["first_comic_hash"] = sqlQuery.value("firstChildHash").toString();
|
||||||
|
|
||||||
items.append(folder);
|
items.append(folder);
|
||||||
}
|
}
|
||||||
@ -87,7 +87,7 @@ void SearchController::getComics(int libraryId, QSqlQuery &sqlQuery, QJsonArray
|
|||||||
json["library_id"] = QString::number(libraryId);
|
json["library_id"] = QString::number(libraryId);
|
||||||
json["file_name"] = sqlQuery.value("fileName").toString();
|
json["file_name"] = sqlQuery.value("fileName").toString();
|
||||||
auto hash = sqlQuery.value("hash").toString();
|
auto hash = sqlQuery.value("hash").toString();
|
||||||
json["file_size"] = hash.right(hash.length() - 40).toLongLong();
|
json["file_size"] = hash.right(hash.length() - 40);
|
||||||
json["hash"] = hash;
|
json["hash"] = hash;
|
||||||
json["current_page"] = sqlQuery.value("currentPage").toInt();
|
json["current_page"] = sqlQuery.value("currentPage").toInt();
|
||||||
json["num_pages"] = sqlQuery.value("numPages").toInt();
|
json["num_pages"] = sqlQuery.value("numPages").toInt();
|
||||||
|
Loading…
Reference in New Issue
Block a user