default dashboard added

This commit is contained in:
Dante
2015-05-08 09:53:25 -04:00
parent c5519a9db5
commit a48a45e1dc
2 changed files with 15 additions and 4 deletions

View File

@@ -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;
};