From 66beb91414d76f599e1cbeb001c07ff5cf4e8534 Mon Sep 17 00:00:00 2001
From: Karim Ahmed <karim.ahmed@xfel.eu>
Date: Thu, 30 Jan 2020 10:18:27 +0100
Subject: [PATCH] remove notebook check and use comm_successful flag

---
 cal_tools/cal_tools/tools.py                   | 5 ++++-
 notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb | 5 +----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/cal_tools/cal_tools/tools.py b/cal_tools/cal_tools/tools.py
index b2ad615d4..34f8e211d 100644
--- a/cal_tools/cal_tools/tools.py
+++ b/cal_tools/cal_tools/tools.py
@@ -412,6 +412,9 @@ def get_constant_from_db_and_time(device, constant, condition, empty_constant,
                           cal_db_interface, creation_time,
                           int(print_once), timeout, ntries)
     if m:
-        return data, m.calibration_constant_version.begin_at
+        if m.comm_db_success:
+            return data, m.calibration_constant_version.begin_at
+        else:
+            return data, None
     else:
         return data, None
diff --git a/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb b/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb
index 7b4e19887..3d34b7934 100644
--- a/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb
+++ b/notebooks/AGIPD/AGIPD_Correct_and_Verify.ipynb
@@ -640,10 +640,7 @@
     "    else:\n",
     "        for key, item in when.items():\n",
     "            if hasattr(item, 'strftime'):\n",
-    "                if item == creation_time:\n",
-    "                    item =  \"Constant was not retrieved\"\n",
-    "                else:\n",
-    "                    item = item.strftime('%y-%m-%d %H:%M')\n",
+    "                item = item.strftime('%y-%m-%d %H:%M')\n",
     "            # If constant retrieval is crashed\n",
     "            else:\n",
     "                item = 'None'\n",
-- 
GitLab