From f3979de5efd4f5a62a523e2fb4e6f968392c22a7 Mon Sep 17 00:00:00 2001 From: Scott Schneider Date: Thu, 30 Apr 2015 18:30:13 -0700 Subject: [PATCH] Check for 'checkout' key if calculating 'running' time --- lib/vmpooler/api/v1.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/vmpooler/api/v1.rb b/lib/vmpooler/api/v1.rb index 5ff6019..1cb6de4 100644 --- a/lib/vmpooler/api/v1.rb +++ b/lib/vmpooler/api/v1.rb @@ -426,7 +426,7 @@ module Vmpooler if rdata['destroy'] result[params[:hostname]]['running'] = ((Time.parse(rdata['destroy']) - Time.parse(rdata['checkout'])) / 60 / 60).round(2) - else + elsif rdata['checkout'] result[params[:hostname]]['running'] = ((Time.now - Time.parse(rdata['checkout'])) / 60 / 60).round(2) end