diff Core/JobsEngine/JobInfo.cpp @ 2573:3372c5255333 jobs

StoreScuJob, Orthanc Explorer for jobs
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 09 May 2018 17:56:14 +0200
parents 2af17cd5eb1f
children a3fdfb6979ed
line wrap: on
line diff
--- a/Core/JobsEngine/JobInfo.cpp	Mon May 07 21:42:04 2018 +0200
+++ b/Core/JobsEngine/JobInfo.cpp	Wed May 09 17:56:14 2018 +0200
@@ -62,7 +62,8 @@
       if (status_.GetProgress() > 0.01f &&
           ms > 0.01f)
       {
-        float remaining = boost::math::llround(1.0f - status_.GetProgress()) * ms;
+        float ratio = static_cast<float>(1.0 - status_.GetProgress());
+        long long remaining = boost::math::llround(ratio * ms);
         eta_ = timestamp_ + boost::posix_time::milliseconds(remaining);
         hasEta_ = true;
       }
@@ -115,7 +116,7 @@
   }
 
 
-  void JobInfo::Format(Json::Value& target) const
+  void JobInfo::Serialize(Json::Value& target) const
   {
     target = Json::objectValue;
     target["ID"] = id_;
@@ -125,9 +126,12 @@
     target["State"] = EnumerationToString(state_);
     target["Timestamp"] = boost::posix_time::to_iso_string(timestamp_);
     target["CreationTime"] = boost::posix_time::to_iso_string(creationTime_);
-    target["Runtime"] = static_cast<uint32_t>(runtime_.total_milliseconds());      
+    target["EffectiveRuntime"] = static_cast<double>(runtime_.total_milliseconds()) / 1000.0;
     target["Progress"] = boost::math::iround(status_.GetProgress() * 100.0f);
-    target["Description"] = status_.GetDescription();
+
+    target["Type"] = status_.GetJobType();
+    target["PublicContent"] = status_.GetPublicContent();
+    target["InternalContent"] = status_.GetInternalContent();
 
     if (HasEstimatedTimeOfArrival())
     {