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

Entity submission create-as-update by logging forceProcessed in source #1251

Merged
merged 5 commits into from
Nov 13, 2024

Conversation

ktuite
Copy link
Member

@ktuite ktuite commented Oct 28, 2024

Closes getodk/central#702, also closes getodk/central#720

simplified version of PR #1232

Adds forceProcessed flag to entity_def_sources table and fills it in.

Uses that to check if, when failing to create an entity because of a uuid conflict, whether the root version of the entity was force-applied. If so, that suggests it's appropriate to try applying the create action as an update instead.

What has been done to verify that this works as intended?

Why is this the best possible solution? Were any other approaches considered?

How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?

Does this change require updates to the API documentation? If so, please update docs/api.yaml as part of this PR.

Before submitting this PR, please make sure you have:

  • run make test and confirmed all checks still pass OR confirm CircleCI build passes
  • verified that any code from external sources are properly credited in comments or that everything is internally sourced

Copy link
Member

@matthew-white matthew-white left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few small questions/comments. It's looking good!

lib/model/query/entities.js Outdated Show resolved Hide resolved
lib/model/query/entities.js Outdated Show resolved Hide resolved
lib/model/query/entities.js Outdated Show resolved Hide resolved
lib/model/query/entities.js Outdated Show resolved Hide resolved
lib/model/query/entities.js Show resolved Hide resolved
lib/model/query/entities.js Outdated Show resolved Hide resolved
@@ -0,0 +1,20 @@
// Copyright 2024 ODK Central Developers
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: change this migration date if merging after https://github.com/getodk/central-backend/pull/1253/files (20241029-01-schedule-entity-form-upgrade-create-forms.js)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(done)

Copy link
Member

@matthew-white matthew-white left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Always exciting to close two issues with one PR. 🚀

lib/model/query/entities.js Outdated Show resolved Hide resolved
lib/model/query/entities.js Outdated Show resolved Hide resolved
lib/model/query/entities.js Outdated Show resolved Hide resolved
lib/model/query/entities.js Show resolved Hide resolved
test/integration/api/offline-entities.js Outdated Show resolved Hide resolved
test/integration/api/offline-entities.js Show resolved Hide resolved
Copy link
Member

@matthew-white matthew-white left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, that was meant to be an approval. 😅

@ktuite ktuite merged commit 9e74cf5 into master Nov 13, 2024
7 checks passed
@ktuite ktuite deleted the ktuite/createAsUpdate branch November 13, 2024 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants