Skip to content

Commit

Permalink
Changed for loop
Browse files Browse the repository at this point in the history
  • Loading branch information
ubuntolog committed Dec 17, 2024
1 parent 5853bc9 commit a6b0706
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/GSvarServer/ServerController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,18 +289,20 @@ HttpResponse ServerController::locateFileByType(const HttpRequest& request)
ServerDB db = ServerDB();
if (db.hasFileLocation(found_file, request.getUrlParams()["type"].toUpper().trimmed(), locus, multiple_files, return_if_missing))
{
QJsonDocument updated_cached_doc;

QJsonArray updated_cached_array;

QJsonDocument cache_doc = db.getFileLocation(found_file, request.getUrlParams()["type"].toUpper().trimmed(), locus, multiple_files, return_if_missing);
db.updateFileLocation(found_file, request.getUrlParams()["type"].toUpper().trimmed(), locus, multiple_files, return_if_missing);

QJsonArray cached_array = cache_doc.array();
Log::error("cached_array.size() " + QString::number(cached_array.size()));
for (int index = 0; index < cached_array.size(); index++)
for (int index = 0; index < cached_array.count(); ++index)
{
Log::error(QString::number(index));
if (cached_array.at(index).isObject())
{
Log::error(QString::number(index) + " is object");
QJsonObject cached_object = cached_array.takeAt(index).toObject();
QString cached_filename = cached_object["filename"].toString();
Log::error("cached_filename = " + cached_filename);
Expand All @@ -316,6 +318,7 @@ HttpResponse ServerController::locateFileByType(const HttpRequest& request)
// Ignore the cache entry, if no URLs were genereated
if (updated_cached_array.size()>0)
{
QJsonDocument updated_cached_doc;
updated_cached_doc.setArray(updated_cached_array);

BasicResponseData response_data;
Expand Down

0 comments on commit a6b0706

Please sign in to comment.