mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 23:40:11 +02:00
Preprocess inventory endpoint result
This commit is contained in:
parent
218d58df81
commit
d605bd9ef4
1 changed files with 15 additions and 2 deletions
|
@ -81,8 +81,10 @@ Rectangle {
|
||||||
if (result.status !== 'success') {
|
if (result.status !== 'success') {
|
||||||
console.log("Failed to get purchases", result.message);
|
console.log("Failed to get purchases", result.message);
|
||||||
} else {
|
} else {
|
||||||
|
var inventoryResult = processInventoryResult(result.data.assets);
|
||||||
|
|
||||||
purchasesModel.clear();
|
purchasesModel.clear();
|
||||||
purchasesModel.append(result.data.assets);
|
purchasesModel.append(inventoryResult);
|
||||||
|
|
||||||
if (previousPurchasesModel.count !== 0) {
|
if (previousPurchasesModel.count !== 0) {
|
||||||
checkIfAnyItemStatusChanged();
|
checkIfAnyItemStatusChanged();
|
||||||
|
@ -93,7 +95,7 @@ Rectangle {
|
||||||
purchasesModel.setProperty(i, "statusChanged", false);
|
purchasesModel.setProperty(i, "statusChanged", false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
previousPurchasesModel.append(result.data.assets);
|
previousPurchasesModel.append(inventoryResult);
|
||||||
|
|
||||||
buildFilteredPurchasesModel();
|
buildFilteredPurchasesModel();
|
||||||
|
|
||||||
|
@ -590,6 +592,17 @@ Rectangle {
|
||||||
// FUNCTION DEFINITIONS START
|
// FUNCTION DEFINITIONS START
|
||||||
//
|
//
|
||||||
|
|
||||||
|
function processInventoryResult(inventory) {
|
||||||
|
for (var i = 0; i < inventory.length; i++) {
|
||||||
|
if (inventory[i].status.length > 1) {
|
||||||
|
console.log("WARNING: Inventory result index " + i + " has a status of length >1!")
|
||||||
|
}
|
||||||
|
inventory[i].status = inventory[i].status[0];
|
||||||
|
inventory[i].categories = inventory[i].categories.join(';');
|
||||||
|
}
|
||||||
|
return inventory;
|
||||||
|
}
|
||||||
|
|
||||||
function populateDisplayedItemCounts() {
|
function populateDisplayedItemCounts() {
|
||||||
var itemCountDictionary = {};
|
var itemCountDictionary = {};
|
||||||
var currentItemId;
|
var currentItemId;
|
||||||
|
|
Loading…
Reference in a new issue