aboutsummaryrefslogtreecommitdiffstats
path: root/script/request-creation-graph
diff options
context:
space:
mode:
authorPetter Reinholdtsen <pere@hungry.com>2015-05-13 09:23:40 +0200
committerPetter Reinholdtsen <pere@hungry.com>2015-05-13 09:23:46 +0200
commit2599858a25148a7b2e4d4815f8e80892b887d494 (patch)
treeb7eca6a596843ead1ed83d0c53009b14bff7f58f /script/request-creation-graph
parent8f9984b66c7ce5d38b07bb6dfef28e914894a92c (diff)
Detect empty databases and report sensible warning.
On a fresh installation with no reports yet, the cron job emit lots of gnuplot errors, causing new site admins to worry what is going wrong. Detect the situation and give a more clear warning about the problem instead.
Diffstat (limited to 'script/request-creation-graph')
-rwxr-xr-xscript/request-creation-graph6
1 files changed, 6 insertions, 0 deletions
diff --git a/script/request-creation-graph b/script/request-creation-graph
index 7d347a7d2..f3baa2326 100755
--- a/script/request-creation-graph
+++ b/script/request-creation-graph
@@ -51,6 +51,12 @@ function grab_data {
# rather nastily, work out the cumulative heights in reverse, so can plot impulses on top of each other
grab_data "where (1 = 1)" $SOURCEA
+if [ ! -s $SOURCEA ] ; then
+ # No data yet, skip graphing
+ echo "warning: no data to graph, skipping task"
+ exit
+fi
+
grab_data "where described_state not in ('waiting_response')" $SOURCEB
grab_data "where described_state not in ('waiting_response', 'waiting_clarification')" $SOURCEC
grab_data "where described_state not in ('waiting_response', 'waiting_clarification', 'not_held')" $SOURCED