diff --git a/workflow/engine/js/strategicDashboard/viewDashboardPresenter.js b/workflow/engine/js/strategicDashboard/viewDashboardPresenter.js
index 13c8be6bf..77968c892 100644
--- a/workflow/engine/js/strategicDashboard/viewDashboardPresenter.js
+++ b/workflow/engine/js/strategicDashboard/viewDashboardPresenter.js
@@ -22,6 +22,7 @@ ViewDashboardPresenter.prototype.userDashboardsViewModel = function(data) {
//if null data is returned we default to an empty array
if (data == null) { data = []; }
var returnList = [];
+ var hasFavorite = false;
$.each(data, function(index, originalObject) {
var map = {
"DAS_TITLE" : "title",
@@ -29,8 +30,17 @@ ViewDashboardPresenter.prototype.userDashboardsViewModel = function(data) {
"DAS_FAVORITE" : "isFavorite"
};
var newObject = that.helper.merge(originalObject, {}, map);
+ if (newObject.isFavorite == 1) {
+ hasFavorite = true;
+ }
returnList.push(newObject);
});
+
+ //if no favorite is selected, the first one is selected.
+ if (!hasFavorite && returnList.length > 0 ) {
+ returnList[0].isFavorite = 1;
+ }
+
return returnList;
};
@@ -88,12 +98,12 @@ ViewDashboardPresenter.prototype.dashboardIndicatorsViewModel = function(data) {
//rounding
newObject.comparative = Math.round(newObject.comparative*100)/100;
- newObject.comparative = ((newObject.comparative > 0)? "+": "") + newObject.comparative;
+ newObject.comparative = ((newObject.comparative > 0) ? "+": "") + newObject.comparative;
newObject.percentComparative = (newObject.percentComparative != '--')
? '(' + newObject.percentComparative + '%)'
: "";
- newObject.percentComparative = (newObject.comparative == 0)
+ newObject.percentComparative = (newObject.comparative == 0 && newObject.percentComparative != '')
? "(0%)"
: newObject.percentComparative;
@@ -255,7 +265,8 @@ ViewDashboardPresenter.prototype.peiViewModel = function(data) {
var newObject = that.helper.merge(originalObject, {}, map);
graphData.push(newObject);
originalObject.efficiencyIndexToShow = that.roundedIndicatorValue(originalObject.efficiencyIndex);
- originalObject.inefficiencyCostToShow = Math.round(originalObject.inefficiencyCost);
+ //rounded to 1 decimal
+ originalObject.inefficiencyCostToShow = Math.round(originalObject.inefficiencyCost * 10) / 10;
originalObject.indicatorId = data.id;
originalObject.json = JSON.stringify(originalObject);
});
@@ -266,7 +277,7 @@ ViewDashboardPresenter.prototype.peiViewModel = function(data) {
this.makeShortLabel(graphData, 10);
retval.dataToDraw = this.adaptGraphData(graphData);
- retval.inefficiencyCostToShow = Math.round(retval.inefficiencyCost);
+ retval.inefficiencyCostToShow = Math.round(retval.inefficiencyCost * 10) / 10;
retval.efficiencyIndexToShow = that.roundedIndicatorValue(retval.efficiencyIndex);
return retval;
};
@@ -284,7 +295,7 @@ ViewDashboardPresenter.prototype.ueiViewModel = function(data) {
};
var newObject = that.helper.merge(originalObject, {}, map);
graphData.push(newObject);
- originalObject.inefficiencyCostToShow = Math.round(originalObject.inefficiencyCost);
+ originalObject.inefficiencyCostToShow = Math.round(originalObject.inefficiencyCost * 10)/10;
originalObject.efficiencyIndexToShow = that.roundedIndicatorValue(originalObject.efficiencyIndex);
originalObject.indicatorId = data.id;
originalObject.json = JSON.stringify(originalObject);
@@ -295,7 +306,7 @@ ViewDashboardPresenter.prototype.ueiViewModel = function(data) {
this.makeShortLabel(graphData, 10);
retval.dataToDraw = this.adaptGraphData(graphData);
- retval.inefficiencyCostToShow = Math.round(retval.inefficiencyCost);
+ retval.inefficiencyCostToShow = Math.round(retval.inefficiencyCost * 10) / 10;
retval.efficiencyIndexToShow = that.roundedIndicatorValue(retval.efficiencyIndex);
return retval;
};
@@ -418,7 +429,7 @@ ViewDashboardPresenter.prototype.returnIndicatorSecondLevelPei = function(modelD
"deviationTime" : "dispersion"
};
var newObject = that.helper.merge(originalObject, {}, map);
- originalObject.inefficiencyCostToShow = Math.round(originalObject.inefficiencyCost);
+ originalObject.inefficiencyCostToShow = Math.round(originalObject.inefficiencyCost * 10) / 10;
originalObject.efficiencyIndexToShow = that.roundedIndicatorValue(originalObject.efficiencyIndex);
originalObject.deviationTimeToShow = Math.round(originalObject.deviationTime);
originalObject.rankToShow = originalObject.rank + "/" + modelData.length;
@@ -445,7 +456,7 @@ ViewDashboardPresenter.prototype.returnIndicatorSecondLevelUei = function(modelD
"deviationTime" : "dispersion"
};
var newObject = that.helper.merge(originalObject, {}, map);
- originalObject.inefficiencyCostToShow = Math.round(originalObject.inefficiencyCost);
+ originalObject.inefficiencyCostToShow = Math.round(originalObject.inefficiencyCost * 10) / 10;
originalObject.efficiencyIndexToShow = that.roundedIndicatorValue(originalObject.efficiencyIndex);
originalObject.deviationTimeToShow = Math.round(originalObject.deviationTime);
originalObject.rankToShow = originalObject.rank + "/" + modelData.length;
diff --git a/workflow/engine/js/strategicDashboard/viewDashboardView.js b/workflow/engine/js/strategicDashboard/viewDashboardView.js
index c5f03c931..6d2f112d3 100644
--- a/workflow/engine/js/strategicDashboard/viewDashboardView.js
+++ b/workflow/engine/js/strategicDashboard/viewDashboardView.js
@@ -535,7 +535,9 @@ var defaultEndDate = function () {
var fillDashboardsList = function (presenterData) {
if (presenterData == null || presenterData.length == 0) {
- $('#dashboardsList').append(G_STRING['ID_NO_DATA_TO_DISPLAY']);
+ $('#dashboardMessage').text(G_STRING['ID_GRID_PAGE_NO_DASHBOARD_MESSAGE']);
+ $('#titleH4').text(G_STRING['ID_GRID_PAGE_NO_DASHBOARD_MESSAGE']);
+ $('#compareIndicators').hide();
}
_.templateSettings.variable = "dashboard";
var template = _.template ($("script.dashboardButtonTemplate").html())
diff --git a/workflow/engine/methods/setup/setupSchemas/triggerFillReportByProcess.sql b/workflow/engine/methods/setup/setupSchemas/triggerFillReportByProcess.sql
index d25283597..bfb22baf7 100644
--- a/workflow/engine/methods/setup/setupSchemas/triggerFillReportByProcess.sql
+++ b/workflow/engine/methods/setup/setupSchemas/triggerFillReportByProcess.sql
@@ -39,7 +39,7 @@ WHERE
APPLICATION.APP_INIT_DATE BETWEEN CAST(@INIT_DATE AS DATETIME) AND CAST(@FINISH_DATE AS DATETIME)
GROUP BY APPLICATION.PRO_UID;
-
+#TODO task duration should be calculated with the calendar
UPDATE PRO_REPORTING
SET PRO_REPORTING.CONFIGURED_PROCESS_TIME = (
SELECT SUM(if (TASK.TAS_TIMEUNIT = "DAYS", (TASK.TAS_DURATION*24), TASK.TAS_DURATION))
diff --git a/workflow/engine/methods/setup/setupSchemas/triggerFillReportByUser.sql b/workflow/engine/methods/setup/setupSchemas/triggerFillReportByUser.sql
index 6479d5ddb..12cadab2c 100644
--- a/workflow/engine/methods/setup/setupSchemas/triggerFillReportByUser.sql
+++ b/workflow/engine/methods/setup/setupSchemas/triggerFillReportByUser.sql
@@ -39,11 +39,15 @@ SELECT
count(if(ACV.DEL_DELAY_DURATION > 0, 1, NULL)) AS TOTAL_CASES_OVERDUE,
count(if(ACV.DEL_DELAY_DURATION <= 0, 1, NULL)) AS TOTAL_CASES_ON_TIME
FROM
- APP_CACHE_VIEW AS ACV
+ APP_CACHE_VIEW AS ACV
WHERE
ACV.DEL_INIT_DATE BETWEEN CAST(@INIT_DATE AS DATETIME) AND CAST(@FINISH_DATE AS DATETIME)
GROUP BY ACV.USR_UID , ACV.TAS_UID , ACV.PRO_UID;
+DELETE USR_REPORTING
+FROM USR_REPORTING
+INNER JOIN TASK ON TASK.TAS_UID = USR_REPORTING.TAS_UID
+WHERE TASK.TAS_TYPE NOT IN ('NORMAL', 'ADHOC');
UPDATE USR_REPORTING
INNER JOIN
@@ -52,10 +56,16 @@ ON USR_REPORTING.USR_UID = USERS.USR_UID
SET USR_REPORTING.USER_HOUR_COST = USERS.USR_COST_BY_HOUR;
UPDATE USR_REPORTING
-INNER JOIN
-TASK
-ON USR_REPORTING.TAS_UID = TASK.TAS_UID
-SET USR_REPORTING.CONFIGURED_TASK_TIME = if (TASK.TAS_TIMEUNIT = "DAYS", (TASK.TAS_DURATION*24), TASK.TAS_DURATION)
-
+INNER JOIN TASK ON USR_REPORTING.TAS_UID = TASK.TAS_UID
+SET USR_REPORTING.CONFIGURED_TASK_TIME =
+IF(TASK.TAS_TIMEUNIT = "DAYS",
+ (TASK.TAS_DURATION *
+ (IF ((SELECT CA.CALENDAR_UID FROM CALENDAR_ASSIGNMENTS AS CA WHERE CA.OBJECT_UID = TASK.TAS_UID limit 1) IS NOT NULL,
+ (SELECT AVG(TIMEDIFF(STR_TO_DATE(CBH.CALENDAR_BUSINESS_END, '%H:%i'), STR_TO_DATE(CBH.CALENDAR_BUSINESS_START, '%H:%i')))/10000
+ FROM CALENDAR_ASSIGNMENTS AS CA, CALENDAR_BUSINESS_HOURS AS CBH
+ WHERE CA.OBJECT_UID = TASK.TAS_UID
+ AND CA.CALENDAR_UID = CBH.CALENDAR_UID
+ GROUP BY CA.CALENDAR_UID LIMIT 1) ,24)))
+,TASK.TAS_DURATION)
diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/Dashboard.php b/workflow/engine/src/ProcessMaker/BusinessModel/Dashboard.php
index 741af63e9..5bb656d86 100644
--- a/workflow/engine/src/ProcessMaker/BusinessModel/Dashboard.php
+++ b/workflow/engine/src/ProcessMaker/BusinessModel/Dashboard.php
@@ -41,26 +41,27 @@ class Dashboard {
$resp = array();
$dashboards = $this->getDashboardsUidByUser($usr_uid);
$existFavorite = false;
+ $cont = 0;
foreach($dashboards as $i=>$x) {
//$resp[$i] = $this->getDashboard($x['DAS_UID']);
$dashboardUser = $this->getDashboard($x['DAS_UID']);
if ($dashboardUser['DAS_STATUS'] == 0) {
continue;
}
- $resp[$i] = $dashboardUser;
+ $resp[$cont] = $dashboardUser;
$Dashboard = new \ProcessMaker\BusinessModel\Dashboard();
$dashConfig = $Dashboard->getConfig($usr_uid);
- $resp[$i]['DAS_FAVORITE'] = 0;
+ $resp[$cont]['DAS_FAVORITE'] = 0;
foreach ($dashConfig as $dashId=>$dashData) {
if($dashId == $x['DAS_UID'] ) {
- $resp[$i]['DAS_FAVORITE'] = $dashData['dashFavorite'];
+ $resp[$cont]['DAS_FAVORITE'] = $dashData['dashFavorite'];
if ($dashData['dashFavorite']==1) {
$existFavorite = true;
}
}
}
+ $cont++;
}
-
//if no favorite is set, the default favorite is the first one
if ($existFavorite == false && $resp != null && sizeof($resp)>0) {
$resp[0]['DAS_FAVORITE'] = 1;
diff --git a/workflow/engine/templates/strategicDashboard/viewDashboard.html b/workflow/engine/templates/strategicDashboard/viewDashboard.html
index 4460e1c8b..7e6477b81 100644
--- a/workflow/engine/templates/strategicDashboard/viewDashboard.html
+++ b/workflow/engine/templates/strategicDashboard/viewDashboard.html
@@ -170,7 +170,9 @@
-
-
+
+