Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dataset properties that are not valid OData identifiers are always empty in entities table #793

Closed
matthew-white opened this issue May 12, 2023 · 2 comments · Fixed by getodk/central-backend#873 or #807
Assignees
Labels
behavior verified Behavior has been manually verified bug entities Multiple Encounter workflows

Comments

@matthew-white
Copy link
Member

matthew-white commented May 12, 2023

If the name of a dataset property is not a valid OData identifier, then a different name will be used for the property in the OData feed (via sanitizeOdataIdentifier() in Backend). In Frontend, the entities table uses the OData feed, but right now, if the name of a property differs from its OData identifier, the property's value is never shown. For example, I created a dataset with a property named circumference.cm, and the property is empty in the table: https://staging.getodk.cloud/#/projects/23/datasets/trees/entities. Yet if you access this entity using the REST API, you can see that its circumference.cm property is not empty: https://staging.getodk.cloud/v1/projects/23/datasets/trees/entities/c3e0d5f0-2af5-44bb-ad3f-26fb9f93288b. I think the issue is that we try to access property data using the name of the property, not its OData identifier:

<td v-for="property of properties" :key="property.id">
<span v-tooltip.text>{{ entity[property.name] }}</span>

This isn't an issue in the submissions table because Frontend specifies a query parameter of odata=true when it sends a request to the form fields endpoint. As a result, the endpoint returns OData identifiers for Frontend to use. I think we could have Backend do something similar for dataset properties, or we could import sanitizeOdataIdentifier() to Frontend and use it here.


Notes for the QA team

A name is a valid OData identifier if it:

  • Contains only alphanumeric characters and underscores.
  • Does not start with a number.

A dataset property name is not required to be a valid OData identifier. A property name:

  • Can contain letters, numbers, underscores, hyphens, and periods.
  • Cannot start with a number, hyphen, or period or with two underscores (__).

If the name of a property is not a valid OData identifier, the property's name will be changed in the OData feed. The entities table in the Central UI uses the OData feed under the hood, which is why there was this issue.

@matthew-white
Copy link
Member Author

matthew-white commented May 19, 2023

@sadiqkhoja, I think we still need to use the new odataName property in Frontend. Would you mind creating a PR for that? I'll work on adding that.

@dbemke
Copy link

dbemke commented May 25, 2023

Tested with success!

@dbemke dbemke added behavior verified Behavior has been manually verified and removed needs testing Needs manual testing labels May 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
behavior verified Behavior has been manually verified bug entities Multiple Encounter workflows
Projects
Status: ✅ done
3 participants