Skip to content

Commit

Permalink
fix(:basecamp:): ensure decodeValues() isnt derailled by attributes n…
Browse files Browse the repository at this point in the history
…ot present in metadata

AFFECTS PACKAGES:
@esri/arcgis-rest-feature-service
  • Loading branch information
jgravois committed Nov 15, 2018
1 parent 84ad2cd commit e9b4581
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 19 deletions.
12 changes: 8 additions & 4 deletions packages/arcgis-rest-feature-service/src/decodeValues.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,14 @@ export function decodeValues(
for (const key in feature.attributes) {
/* istanbul ignore next */
if (!feature.attributes.hasOwnProperty(key)) continue;
feature.attributes[key] = convertAttribute(
feature.attributes,
fieldsObject[key]
);

// trap for summary statistics fields or anything else not present in the raw dataset
if (fieldsObject[key]) {
feature.attributes[key] = convertAttribute(
feature.attributes,
fieldsObject[key]
);
}
}
});
return clonedResponse;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ export const cvdQueryResponse: IQueryFeaturesResponse = {
alias: "Floor Number",
type: "esriFieldTypeString",
length: 5
},
{
name: "floor_SUM",
alias: "Floor Number Summary (not in raw dataset, only from stat query",
type: "esriFieldTypeString",
length: 10
}
],
features: [
Expand All @@ -99,7 +105,8 @@ export const cvdQueryResponse: IQueryFeaturesResponse = {
status: "Closed",
globalid: "{2F47ACF0-CEE3-4548-90A8-785ED7BE01C9}",
building: null,
floor: null
floor: null,
floor_SUM: "something"
},
geometry: {
x: -9603128.0234949309,
Expand All @@ -119,7 +126,8 @@ export const cvdQueryResponse: IQueryFeaturesResponse = {
status: "Closed",
globalid: "{9937CFDD-E811-49D1-8CC8-A1ABF0DE7F14}",
building: null,
floor: null
floor: null,
floor_SUM: "something"
},
geometry: {
x: -9603103.0477722641,
Expand All @@ -139,7 +147,8 @@ export const cvdQueryResponse: IQueryFeaturesResponse = {
status: "Unassigned",
globalid: "{D840094C-F94D-42EA-AB21-7A84B2E27962}",
building: null,
floor: "0"
floor: "0",
floor_SUM: "something"
},
geometry: {
x: -9814396.0827533137,
Expand All @@ -163,7 +172,8 @@ export const cvdFeaturesFormatted: IFeature[] = [
status: "Closed",
globalid: "{2F47ACF0-CEE3-4548-90A8-785ED7BE01C9}",
building: null,
floor: null
floor: null,
floor_SUM: "something"
},
geometry: {
x: -9603128.0234949309,
Expand All @@ -183,7 +193,8 @@ export const cvdFeaturesFormatted: IFeature[] = [
status: "Closed",
globalid: "{9937CFDD-E811-49D1-8CC8-A1ABF0DE7F14}",
building: null,
floor: null
floor: null,
floor_SUM: "something"
},
geometry: {
x: -9603103.0477722641,
Expand All @@ -203,7 +214,8 @@ export const cvdFeaturesFormatted: IFeature[] = [
status: "Unassigned",
globalid: "{D840094C-F94D-42EA-AB21-7A84B2E27962}",
building: null,
floor: "0"
floor: "0",
floor_SUM: "something"
},
geometry: {
x: -9814396.0827533137,
Expand Down
9 changes: 0 additions & 9 deletions packages/arcgis-rest-feature-service/test/mocks/fields.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,6 @@ export const serviceFields: IField[] = [
nullable: true,
length: 100
},
{
name: "comments",
type: "esriFieldTypeString",
alias: "Comments",
domain: null,
editable: true,
nullable: true,
length: 255
},
{
name: "name",
type: "esriFieldTypeString",
Expand Down

0 comments on commit e9b4581

Please sign in to comment.