changeset 411:3aa058dcd5fb

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 12 Nov 2018 16:07:42 +0100
parents 6decc0ba9da5
children 71c16998fcc8
files Applications/Samples/SimpleViewer/SimpleViewerApplication.cpp Applications/Samples/SimpleViewerApplicationSingleFile.h
diffstat 2 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/Samples/SimpleViewer/SimpleViewerApplication.cpp	Mon Nov 12 15:52:03 2018 +0100
+++ b/Applications/Samples/SimpleViewer/SimpleViewerApplication.cpp	Mon Nov 12 16:07:42 2018 +0100
@@ -104,7 +104,8 @@
   {
     const Json::Value& response = message.GetJson();
 
-    if (response.isArray() && response.size() > 1)
+    if (response.isArray() &&
+        response.size() >= 1)
     {
       SelectStudy(response[0].asString());
     }
@@ -126,7 +127,9 @@
   {
     const Json::Value& response = message.GetJson();
 
-    if (response.isObject() && response["Instances"].isArray() && response["Instances"].size() > 0)
+    if (response.isObject() &&
+        response["Instances"].isArray() &&
+        response["Instances"].size() > 0)
     {
       // keep track of all instances IDs
       const std::string& seriesId = response["ID"].asString();
--- a/Applications/Samples/SimpleViewerApplicationSingleFile.h	Mon Nov 12 15:52:03 2018 +0100
+++ b/Applications/Samples/SimpleViewerApplicationSingleFile.h	Mon Nov 12 16:07:42 2018 +0100
@@ -338,11 +338,13 @@
       {
         const Json::Value& response = message.GetJson();
 
-        if (response.isArray() && response.size() > 1)
+        if (response.isArray() &&
+            response.size() >= 1)
         {
           SelectStudy(response[0].asString());
         }
       }
+      
       void OnStudyReceived(const OrthancApiClient::JsonResponseReadyMessage& message)
       {
         const Json::Value& response = message.GetJson();
@@ -402,6 +404,7 @@
 
       void SelectStudy(const std::string& studyId)
       {
+        LOG(INFO) << "Selecting study: " << studyId;
         orthancApiClient_->GetJsonAsync("/studies/" + studyId, new Callable<SimpleViewerApplication, OrthancApiClient::JsonResponseReadyMessage>(*this, &SimpleViewerApplication::OnStudyReceived));
       }