fix es storage object

This commit is contained in:
Niko Storni 2019-10-30 17:57:40 +01:00
parent e7cf20eda4
commit f1ad94d29d

View file

@ -75,7 +75,7 @@ export async function claimSync () {
console.error('Failed to process claim ' + claim.claimId + ' due to missing value'); console.error('Failed to process claim ' + claim.claimId + ' due to missing value');
continue; continue;
} }
claim.value = JSON.parse(claim.value).Claim; claim.value = claim.value.Claim;
if (claim.name && claim.value) { if (claim.name && claim.value) {
claim.suggest_name = { claim.suggest_name = {
input : '' + claim.name + '', input : '' + claim.name + '',
@ -217,6 +217,13 @@ function getClaimsSince (time, lastID, MaxClaimsInCall) {
let claims = []; let claims = [];
for (let i = 0; i < results.length; i++) { for (let i = 0; i < results.length; i++) {
let r = results[i]; let r = results[i];
let value = null;
try {
value = JSON.parse(r.value);
} catch (e) {
console.error(e);
console.error(r.value);
}
claims.push({ claims.push({
id : r.id, id : r.id,
name : r.name, name : r.name,
@ -225,7 +232,7 @@ function getClaimsSince (time, lastID, MaxClaimsInCall) {
effective_amount : r.effective_amount, effective_amount : r.effective_amount,
certificate_amount: r.certificate_amount, certificate_amount: r.certificate_amount,
claimId : r.claimId, claimId : r.claimId,
value : r.value, value : value,
}); });
} }
resolve(claims); resolve(claims);