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

After updating an entity the number in the "Download x Entities” button for a moment shows a higher number (+1) #560

Closed
dbemke opened this issue Dec 7, 2023 · 5 comments
Assignees
Labels
backend Requires a change to the API server behavior verified Behavior has been manually verified bug entities Multiple Encounter workflows frontend Requires a change to the UI

Comments

@dbemke
Copy link

dbemke commented Dec 7, 2023

Problem description

After updating an entity the number in the "Download x Entities” button for a moment shows a higher number (+1) than the number of entities in the entities table (the Data tab).
After following the steps below, if I refresh the page again (sometimes more than once) the number will get corrected. When the number is wrong in the downloaded CSV there isn't an extra record.
Some time after filing the issue I reopened the link below and I can see that the number is again +1 although it got corrected after refreshing.

URL of the page

used forms and dataset in
https://staging.getodk.cloud/#/projects/62/entity-lists/trees/entities

Steps to reproduce the problem

(Preconditions: Trees registration and Trees update form are added in Collect)

  1. Submit a new entity in Trees registration form via Collect.
  2. Go to Entity Data tab on Central and refresh the table if necessary (don’t close the tab).
  3. In Collect in "Start new form" refresh the list of forms to download the newest entity.
  4. Go to Trees update form and update the new entity and send the form.
  5. Go back to Central to the Data tab refresh the table and refresh the page.
  6. Check the number on the button "Download x entities”

Screenshot

AfterRefresh
downloadEntities

Expected behavior

The number of entities on the list should be equal to the number of entities to download.

Central version shown in version.txt

staging versions:
versions:
d2345d0 (v2023.4.0-5-gd2345d0)
+4b5d237c5d83f7fc5c64dce79229f9edd97cff62 client (v2023.4.0-46-g4b5d237c)
+c2580569befe146837d770185e49b61ebab5d06e server (v2023.4.0-44-gc2580569)

@dbemke dbemke changed the title After updating an entity the number in the "Download x Entities” button for a moment shows a higher number (+1) in the Data tab After updating an entity the number in the "Download x Entities” button for a moment shows a higher number (+1) Dec 7, 2023
@matthew-white
Copy link
Member

I can see at least two issues on this page:

  • The extended metadata for the entity list isn't correct. The entities property is 9 instead of 8.
  • (Less critical, but still unexpected:) When the entities property differs from the OData count, Frontend is supposed to use the OData count, which is more likely to be up-to-date. It does that by patching dataset.entities with the OData count. However, that doesn't seem to be happening here.

@matthew-white matthew-white added backend Requires a change to the API server frontend Requires a change to the UI needs testing Needs manual testing entities Multiple Encounter workflows labels Dec 7, 2023
@github-project-automation github-project-automation bot moved this to 🕒 backlog in ODK Central Dec 7, 2023
@matthew-white matthew-white self-assigned this Dec 12, 2023
@matthew-white matthew-white moved this from 🕒 backlog to ✏️ in progress in ODK Central Dec 12, 2023
matthew-white added a commit to getodk/central-frontend that referenced this issue Dec 12, 2023
matthew-white added a commit to getodk/central-frontend that referenced this issue Dec 13, 2023
matthew-white added a commit to getodk/central-backend that referenced this issue Dec 13, 2023
@matthew-white
Copy link
Member

matthew-white commented Dec 13, 2023

I think this issue is now resolved. When I visit the URL and refresh the page several times, I always see that the count in the button matches the number of rows of the table.

I think the issue had to do with deleted entities: deleted entities were not included in OData or the CSV download, but they were included in the count shown in the button. This entity list had one deleted entity.

After following the steps below, if I refresh the page again (sometimes more than once) the number will get corrected.

I think (but am not 100% sure) that this intermittency had to with the order of responses from the server. If the UI received the entity list object before the OData, then I think it would show the incorrect count in the button. However, if it received the OData before the entity list object, then it would show the correct count.

After updating an entity the number in the "Download x Entities” button for a moment shows a higher number (+1) than the number of entities in the entities table (the Data tab).

Does that mean that the count in the button sometimes changed even without refreshing the page? Or did it only change when you refreshed the page?

I think the count in the button should now be correct and consistent with the number of rows of the table. If you create or delete an entity, then click the refresh button, the count in the button should change to match the updated number of entities. You should never have to refresh the page to make the two counts match. Let me know if you see any issues related to these counts!

@github-project-automation github-project-automation bot moved this from ✏️ in progress to ✅ done in ODK Central Dec 13, 2023
@dbemke
Copy link
Author

dbemke commented Dec 13, 2023

(Before the fix) At first when I used the refresh button the count in the button didn't change, if I refreshed the page the count in the button was wrong. Afterwards refreshing the page changed the number in button to: ok number and +1 number so it was like back and forth changing the number.
Here's a video of testing (before the fix).
https://jam.dev/c/52907cf2-0cde-4d22-a84c-e0d6b0e2812d

@srujner
Copy link

srujner commented Dec 13, 2023

Tested with Success!

1 similar comment
@dbemke
Copy link
Author

dbemke commented Dec 13, 2023

Tested with Success!

@dbemke dbemke added behavior verified Behavior has been manually verified and removed needs testing Needs manual testing labels Dec 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Requires a change to the API server behavior verified Behavior has been manually verified bug entities Multiple Encounter workflows frontend Requires a change to the UI
Projects
Status: ✅ done
Development

No branches or pull requests

3 participants