Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function parseOdataResponse(response) {
if (response === undefined || response === null) {
throw new Error('Odata error : parsing result');
}
// To be comaptible with C# ODataController
_.extend(response, utilHelper.flatten({
odata: response.odata
}));
delete response.odata;
if (response["odata.count"] === undefined || response["odata.count"] === null) {
throw new Error('Odata error : parsing result');
}
return {
totalRecords: response["odata.count"],
values: response.value
};
}
function parseOdataResponse(response) {
if (response === undefined || response === null) {
throw new Error('Odata error : parsing result');
}
// To be comaptible with C# ODataController
_.extend(response, utilHelper.flatten({
odata: response.odata
}));
delete response.odata;
if (response["odata.count"] === undefined || response["odata.count"] === null) {
throw new Error('Odata error : parsing result');
}
return {
totalRecords: response["odata.count"],
values: response.value
};
}
var promise = response.promise.then(function (data) {
var result = {
Payload: data.value,
CurrentPage: 1,
TotalPages: 1,
TotalRecordCount: 1,
FilteredRecordCount: 1
};
result.TotalRecordCount = parseInt(data['odata.count']);
result.FilteredRecordCount = result.TotalRecordCount; // TODO: Calculate filtered items
result.TotalPages = parseInt((result.FilteredRecordCount + params.Take - 1) / params.Take);
result.CurrentPage = parseInt(1 + ((params.Skip / result.FilteredRecordCount) * result.TotalPages));
if (result.CurrentPage > result.TotalPages) {
result.CurrentPage = 1;
request.data = params;
request.data.Skip = 0;
request.serverUrl = originalUrl;
me.retrieveDataAsync(request).promise.then(function (newData) {
result.Payload = newData.value;
});
}
total: function (data) {
var total = data["odata.count"] || data["@odata.count"];
return Math.ceil(total / p.rowNum);
},
userdata: "userdata"
function parseOdataResponse(response) {
if (response === undefined || response === null || response["odata.count"] === undefined || response["odata.count"] === null) {
throw new Error('Odata error : parsing result');
}
return {
totalRecords: response["odata.count"],
values: response.value
};
}
private fixResult(result: any): adapters.IAdapterResult {
var data = result,
count = -1;
if (result["odata.metadata"]) {
if (result["odata.count"])
count = result["odata.count"];
data = result.value;
}
else if (!query) {
count = result.length;
}
return {
data: data,
count: count
};
}
private ajax(url: string, type: string = "GET", data?: any): JQueryPromise {
.then(function (data) {
$scope.totalAvailableEpisodes = data["odata.count"];
for (var i = 0; i < data.value.length; i++) {
$scope.episodes.push(data.value[i]);
}
$scope.boolBusy = false;
});
}
.then(function (data) {
if (data["odata.metadata"]) {
if (data["odata.count"])
count = data["odata.count"];
data = data.value;
}
else if (data.__count) {
count = data.__count;
data = data.results;
}
else if (!query) {
count = data.length;
}
return data;
})
.then(function (data) {
.then(function (data) {
if (data["odata.metadata"]) {
if (data["odata.count"])
count = data["odata.count"];
data = data.value;
}
else if (data.__count) {
count = data.__count;
data = data.results;
}
else if (!query) {
count = data.length;
}
return data;
})
.then(function (data) {