airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject [40/50] [abbrv] airavata-php-gateway git commit: fixing experiment statistics time issue.
Date Wed, 29 Jul 2015 17:49:12 GMT
fixing experiment statistics time issue.


Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/9bb22f16
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/9bb22f16
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/9bb22f16

Branch: refs/heads/master
Commit: 9bb22f16ad3750c8a3221473707eb1bed4516ae8
Parents: 9d92024
Author: Supun Nakandala <scnakandala@apache.org>
Authored: Fri Jul 24 15:16:26 2015 -0400
Committer: Supun Nakandala <scnakandala@apache.org>
Committed: Fri Jul 24 15:16:26 2015 -0400

----------------------------------------------------------------------
 app/config/pga_config.php.template              |  5 +++++
 app/controllers/AdminController.php             | 14 ++++++++++---
 app/views/admin/experiment-statistics.blade.php | 21 ++++++++++++++++++++
 3 files changed, 37 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/9bb22f16/app/config/pga_config.php.template
----------------------------------------------------------------------
diff --git a/app/config/pga_config.php.template b/app/config/pga_config.php.template
index 19c4707..9701110 100644
--- a/app/config/pga_config.php.template
+++ b/app/config/pga_config.php.template
@@ -82,6 +82,11 @@ return array(
         'airavata-timeout' => '1000000',
 
         /**
+         * Time zone of the location where the Airavata API server is hosted
+         */
+        'time-zone' => 'EST5EDT',
+
+        /**
          * PGA Gateway ID
          */
         'gateway-id' => 'default',

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/9bb22f16/app/controllers/AdminController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AdminController.php b/app/controllers/AdminController.php
index 20e97c6..0dee8e2 100644
--- a/app/controllers/AdminController.php
+++ b/app/controllers/AdminController.php
@@ -176,8 +176,15 @@ class AdminController extends BaseController {
     {
         if (Request::ajax()) {
             $inputs = Input::all();
-            $expStatistics = AdminUtilities::get_experiment_execution_statistics(strtotime($inputs['fromTime'])
* 1000
-                , strtotime($inputs['toTime']) * 1000);
+            date_default_timezone_set('UTC');
+            $fromTime = new DateTime(strtotime($inputs['fromTime']));
+            $fromTime->setTimezone(new DateTimeZone(Config::get('pga_config.airavata')["time-zone"]));
+            $fromTime = strtotime($fromTime->format('Y-m-d H:i:s'));
+            $toTime = new DateTime(strtotime($inputs['toTime']));
+            $toTime->setTimezone(new DateTimeZone(Config::get('pga_config.airavata')["time-zone"]));
+            $toTime = strtotime($toTime->format('Y-m-d H:i:s'));
+            $expStatistics = AdminUtilities::get_experiment_execution_statistics($fromTime
* 1000
+                , $toTime * 1000);
             return View::make("admin/experiment-statistics", array("expStatistics" =>
$expStatistics));
         }
     }
@@ -188,7 +195,8 @@ class AdminController extends BaseController {
             $inputs = Input::all();
             $expContainer = AdminUtilities::get_experiments_of_time_range($inputs);
             $expStates = ExperimentUtilities::getExpStates();
-            return View::make("partials/experiment-container", array("expContainer" =>
$expContainer, "expStates" => $expStates));
+            return View::make("partials/experiment-container", array("expContainer" =>
array_reverse($expContainer),
+                "expStates" => $expStates));
         }
     }
 

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/9bb22f16/app/views/admin/experiment-statistics.blade.php
----------------------------------------------------------------------
diff --git a/app/views/admin/experiment-statistics.blade.php b/app/views/admin/experiment-statistics.blade.php
index 8df69db..d1efbd1 100644
--- a/app/views/admin/experiment-statistics.blade.php
+++ b/app/views/admin/experiment-statistics.blade.php
@@ -145,10 +145,31 @@
 <div id="experiment-container" style="margin: 20px" class="experiment-container"></div>
 
 <script>
+
+    function convertToUtc(str) {
+
+        var date = new Date(str);
+        var year = date.getUTCFullYear();
+        var month = date.getUTCMonth()+1;
+        var dd = dategetUTCDate();
+        var hh = date.getUTCHours();
+        var mi = date.getUTCMinutes();
+        var sec = date.getUTCSeconds();
+
+        // 2010-11-12T13:14:15Z
+
+        theDate = year + "-" + (month [1] ? month : "0" + month [0]) + "-" +
+            (dd[1] ? dd : "0" + dd[0]);
+        theTime = (hh[1] ? hh : "0" + hh[0]) + ":" + (mi[1] ? mi : "0" + mi[0]);
+        return [ theDate, theTime ].join("T");
+    }
+
     $("#getAllExperiments").click(function () {
         //These are coming from manage-experiments.blade.php
         $fromTime = $("#datetimepicker9").find("input").val();
+        $fromTime = convertToUtc($fromTime);
         $toTime = $("#datetimepicker10").find("input").val();
+        $toTime - convertToUtc($toTime);
         if ($fromTime == '' || $toTime == '') {
             alert("Please Select Valid Date Inputs!");
         } else {


Mime
View raw message