-
Notifications
You must be signed in to change notification settings - Fork 75
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
Log create-as-update as a conflict #1319
Conversation
8d6512c
to
7ed2b18
Compare
lib/model/query/entities.js
Outdated
submission: { instanceId: submissionDef.instanceId } | ||
submission: { | ||
instanceId: submissionDef.instanceId, | ||
...createSubAsUpdate ? { action: 'create' } : {} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe go outside of submission
because this is like a Submission object.
lib/data/entity.js
Outdated
if (createAsUpdate) | ||
v.conflictingProperties = Object.keys(v.dataReceived); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look at how conflictingProperties is computed and saved in the database over here: https://github.com/getodk/central-backend/blob/master/lib/model/query/entities.js#L307-L320
Don't artificially make up conflicting properties!
.expect(200) | ||
.then(({ body }) => { | ||
body.map(v => v.conflict).should.eql([null, 'hard']); | ||
body[1].conflictingProperties.should.eql(['age', 'label', 'status', 'first_name']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These will probably change
// Check that entity as a whole is a conflict | ||
await asAlice.get('/v1/projects/1/datasets/people/entities/12345678-1234-4123-8234-123456789ddd') | ||
.then(({ body }) => { | ||
body.conflict.should.equal('soft'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will change to hard.
Closes getodk/central#815
From here:
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:
make test
and confirmed all checks still pass OR confirm CircleCI build passes