From ee8b8311dc260e9024bc7b59bd2d9ade154e9e0a Mon Sep 17 00:00:00 2001
From: Emanuele Laface <emanuele.laface@gmail.com>
Date: Tue, 1 Sep 2020 15:39:37 +0200
Subject: [PATCH] Fixes

---
 PythonServer/screens/mcu.py | 11 ++++++++---
 WebSites/mcu/dashboard.json |  4 ++--
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/PythonServer/screens/mcu.py b/PythonServer/screens/mcu.py
index ce477b1..6da0f35 100755
--- a/PythonServer/screens/mcu.py
+++ b/PythonServer/screens/mcu.py
@@ -14,9 +14,14 @@ def get_from_archiver(pv, start_date, end_date):
             pv, start_date, end_date
         )
         entries = int(requests.get(url).json()[0]["data"][0]["val"])
-        url = "http://archiver-utgard.cslab.esss.lu.se:17668/retrieval/data/getData.json?pv=nth_{}({})&from={}&to={}".format(
-            int(entries // 100), pv, start_date, end_date
-        )
+        if entries > 100:
+            url = "http://archiver-utgard.cslab.esss.lu.se:17668/retrieval/data/getData.json?pv=nth_{}({})&from={}&to={}".format(
+                int(entries // 100), pv, start_date, end_date
+            )
+        else:
+            url = "http://archiver-utgard.cslab.esss.lu.se:17668/retrieval/data/getData.json?pv=nth_{}({})&from={}&to={}".format(
+                1, pv, start_date, end_date
+            )
         r = requests.get(url).json()[0]["data"]
         raw_data = pandas.DataFrame.from_dict(r)
         return list(
diff --git a/WebSites/mcu/dashboard.json b/WebSites/mcu/dashboard.json
index fc4008c..0e09474 100644
--- a/WebSites/mcu/dashboard.json
+++ b/WebSites/mcu/dashboard.json
@@ -1,7 +1,7 @@
 {
 	"version": 1,
 	"header_image": "",
-	"allow_edit": true,
+	"allow_edit": false,
 	"plugins": [],
 	"panes": [
 		{
@@ -58,7 +58,7 @@
 				{
 					"type": "html",
 					"settings": {
-						"html": "<script>\n    function setDatasource(event) {\n\t\tfreeboard.showLoadingIndicator(true);\n\t};\n</script>\n<div style=\"position:relative;height:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;\">\n        <select style=\"padding:0px 0px\" onchange=\"setDatasource()\" id=\"time-series\">\n            <option value=\"2w\">Two Weeks</option>\n            <option value=\"1w\">One Week</option>\n            <option value=\"2d\">Two Days</option>\n            <option value=\"1d\">One Day</option>\n            <option value=\"live\">Live</option>\n        </select>\n</div>",
+						"html": "<script>\n    function setDatasource(event) {\n\t\tfreeboard.showLoadingIndicator(true);\n\t};\n</script>\n<div style=\"position:relative;height:100%;display:flex;flex-direction:column;justify-content:center;align-items:center;\">\n        <select style=\"padding:0px 0px\" onchange=\"setDatasource()\" id=\"time-series\">\n            <option value=\"2w\">Two Weeks</option>\n            <option value=\"1w\">One Week</option>\n            <option value=\"2d\">Two Days</option>\n            <option value=\"1d\">One Day</option>\n            <option value=\"4h\">Four Hours</option>\n            <option value=\"1h\">One Hour</option>\n            <option value=\"live\">Live</option>\n        </select>\n</div>",
 						"height": 1
 					}
 				}
-- 
GitLab