airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scnakand...@apache.org
Subject airavata-php-gateway git commit: fixing bug in date manipulation in experiment statistics
Date Fri, 24 Jul 2015 20:20:27 GMT
Repository: airavata-php-gateway
Updated Branches:
  refs/heads/0.15-release-branch 6a4850fd5 -> bac71decd


fixing bug in date manipulation in experiment statistics


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/bac71dec
Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/bac71dec
Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/bac71dec

Branch: refs/heads/0.15-release-branch
Commit: bac71decd334041d2e8a4abdbdf8e310796494f1
Parents: 6a4850f
Author: Supun Nakandala <scnakandala@apache.org>
Authored: Fri Jul 24 16:19:56 2015 -0400
Committer: Supun Nakandala <scnakandala@apache.org>
Committed: Fri Jul 24 16:19:56 2015 -0400

----------------------------------------------------------------------
 app/controllers/AdminController.php             |  8 ++--
 app/views/admin/experiment-statistics.blade.php | 42 ++++++--------------
 app/views/admin/manage-experiments.blade.php    | 22 +---------
 3 files changed, 18 insertions(+), 54 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/bac71dec/app/controllers/AdminController.php
----------------------------------------------------------------------
diff --git a/app/controllers/AdminController.php b/app/controllers/AdminController.php
index 0dee8e2..ff5df9a 100644
--- a/app/controllers/AdminController.php
+++ b/app/controllers/AdminController.php
@@ -177,12 +177,12 @@ class AdminController extends BaseController {
         if (Request::ajax()) {
             $inputs = Input::all();
             date_default_timezone_set('UTC');
-            $fromTime = new DateTime(strtotime($inputs['fromTime']));
+            $fromTime = new DateTime($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']));
+            $fromTime = strtotime($fromTime->format('m/d/y H:i'));
+            $toTime = new DateTime($inputs['toTime']);
             $toTime->setTimezone(new DateTimeZone(Config::get('pga_config.airavata')["time-zone"]));
-            $toTime = strtotime($toTime->format('Y-m-d H:i:s'));
+            $toTime = strtotime($toTime->format('m/d/y H:i'));
             $expStatistics = AdminUtilities::get_experiment_execution_statistics($fromTime
* 1000
                 , $toTime * 1000);
             return View::make("admin/experiment-statistics", array("expStatistics" =>
$expStatistics));

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/bac71dec/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 db36157..59a6cdb 100644
--- a/app/views/admin/experiment-statistics.blade.php
+++ b/app/views/admin/experiment-statistics.blade.php
@@ -146,30 +146,12 @@
 
 <script>
 
-    function convertToUtc(str) {
-
-        var date = new Date(str);
-        var year = date.getUTCFullYear();
-        var month = date.getUTCMonth()+1;
-        var dd = date.getUTCDate();
-        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);
+        $fromTime = moment($fromTime).utc().format('MM/DD/YYYY hh:mm a');
         $toTime = $("#datetimepicker10").find("input").val();
-        $toTime - convertToUtc($toTime);
+        $toTime = moment($toTime).utc().format('MM/DD/YYYY hh:mm a');
         if ($fromTime == '' || $toTime == '') {
             alert("Please Select Valid Date Inputs!");
         } else {
@@ -198,9 +180,9 @@
     $("#getCreatedExperiments").click(function () {
         //These are coming from manage-experiments.blade.php
         $fromTime = $("#datetimepicker9").find("input").val();
-        $fromTime = convertToUtc($fromTime);
+        $fromTime = moment($fromTime).utc().format('MM/DD/YYYY hh:mm a');
         $toTime = $("#datetimepicker10").find("input").val();
-        $toTime - convertToUtc($toTime);
+        $toTime = moment($toTime).utc().format('MM/DD/YYYY hh:mm a');
 
         if ($fromTime == '' || $toTime == '') {
             alert("Please Select Valid Date Inputs!");
@@ -230,9 +212,9 @@
     $("#getRunningExperiments").click(function () {
         //These are coming from manage-experiments.blade.php
         $fromTime = $("#datetimepicker9").find("input").val();
-        $fromTime = convertToUtc($fromTime);
+        $fromTime = moment($fromTime).utc().format('MM/DD/YYYY hh:mm a');
         $toTime = $("#datetimepicker10").find("input").val();
-        $toTime - convertToUtc($toTime);
+        $toTime = moment($toTime).utc().format('MM/DD/YYYY hh:mm a');
         if ($fromTime == '' || $toTime == '') {
             alert("Please Select Valid Date Inputs!");
         } else {
@@ -261,9 +243,9 @@
     $("#getCompletedExperiments").click(function () {
         //These are coming from manage-experiments.blade.php
         $fromTime = $("#datetimepicker9").find("input").val();
-        $fromTime = convertToUtc($fromTime);
+        $fromTime = moment($fromTime).utc().format('MM/DD/YYYY hh:mm a');
         $toTime = $("#datetimepicker10").find("input").val();
-        $toTime - convertToUtc($toTime);
+        $toTime = moment($toTime).utc().format('MM/DD/YYYY hh:mm a');
         if ($fromTime == '' || $toTime == '') {
             alert("Please Select Valid Date Inputs!");
         } else {
@@ -292,9 +274,9 @@
     $("#getCancelledExperiments").click(function () {
         //These are coming from manage-experiments.blade.php
         $fromTime = $("#datetimepicker9").find("input").val();
-        $fromTime = convertToUtc($fromTime);
+        $fromTime = moment($fromTime).utc().format('MM/DD/YYYY hh:mm a');
         $toTime = $("#datetimepicker10").find("input").val();
-        $toTime - convertToUtc($toTime);
+        $toTime = moment($toTime).utc().format('MM/DD/YYYY hh:mm a');
         if ($fromTime == '' || $toTime == '') {
             alert("Please Select Valid Date Inputs!");
         } else {
@@ -323,9 +305,9 @@
     $("#getFailedExperiments").click(function () {
         //These are coming from manage-experiments.blade.php
         $fromTime = $("#datetimepicker9").find("input").val();
-        $fromTime = convertToUtc($fromTime);
+        $fromTime = moment($fromTime).utc().format('MM/DD/YYYY hh:mm a');
         $toTime = $("#datetimepicker10").find("input").val();
-        $toTime - convertToUtc($toTime);
+        $toTime = moment($toTime).utc().format('MM/DD/YYYY hh:mm a');
         if ($fromTime == '' || $toTime == '') {
             alert("Please Select Valid Date Inputs!");
         } else {

http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/bac71dec/app/views/admin/manage-experiments.blade.php
----------------------------------------------------------------------
diff --git a/app/views/admin/manage-experiments.blade.php b/app/views/admin/manage-experiments.blade.php
index 60d439c..dc82a92 100644
--- a/app/views/admin/manage-experiments.blade.php
+++ b/app/views/admin/manage-experiments.blade.php
@@ -372,29 +372,11 @@ to be uncommented when actually in use.
         $('#datetimepicker9').data("DateTimePicker").setMaxDate(e.date);
     });
 
-    function convertToUtc(str) {
-
-        var date = new Date(str);
-        var year = date.getUTCFullYear();
-        var month = date.getUTCMonth()+1;
-        var dd = date.getUTCDate();
-        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");
-    }
-
     $("#getStatistics").click(function () {
         $fromTime = $("#datetimepicker9").find("input").val();
-        $fromTime = convertToUtc($fromTime);
+        $fromTime = moment($fromTime).utc().format('MM/DD/YYYY hh:mm a');
         $toTime = $("#datetimepicker10").find("input").val();
-        $toTime - convertToUtc($toTime);
+        $toTime = moment($toTime).utc().format('MM/DD/YYYY hh:mm a');
         if ($fromTime == '' || $toTime == '') {
             alert("Please Select Valid Date Inputs!");
         } else {


Mime
View raw message