-
Notifications
You must be signed in to change notification settings - Fork 78
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
Features/entities/auto convert sub to entities #870
Features/entities/auto convert sub to entities #870
Conversation
a4ae37d
to
062d4f9
Compare
lib/model/query/entities.js
Outdated
const processSubmissionEvent = (event) => | ||
_processionSubmissionEvent(event, event.details.submissionId, event.details.submissionDefId, event.acteeId); | ||
|
||
const createEntitiesFromPendingSubmissions = (pendingSubmissions, event) => (container) => |
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.
eventId for logging should be submission create event or latest update event
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.
and add information about this grand event in details column of entity_source
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.
Just my two cents, I vote for making the dataset.update
event the primary source event. That's because the dataset.update
event is the event in the causal chain that immediately preceded the creation of the entity. Sort of like how with submission approval, the approval is just the last step that caused the creation of the entity. The entity …/audits endpoint should still return the submissionCreate
property, but it seems potentially helpful for the sourceEvent
returned to be the dataset.update
event. No strong feelings, feel free to ignore!
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.
will you show this event on the frontend?
505a2d8
to
32d7df6
Compare
update.audit = (datasets, data) => (log) => log('dataset.update', datasets, { data }); | ||
update.audit = (datasets, data, autoConvert) => (log) => log('dataset.update', datasets, { data, autoConvert }); | ||
|
||
const _unprocessedSubmissions = (datasetId, fields) => sql` |
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.
I think draft submissions need to be excluded: see #880. I think the flag submissions.draft
can be used.
update.audit = (datasets, data) => (log) => log('dataset.update', datasets, { data }); | ||
update.audit = (datasets, data, autoConvert) => (log) => log('dataset.update', datasets, { data, autoConvert }); | ||
|
||
const _unprocessedSubmissions = (datasetId, fields) => sql` |
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.
I think deleted submissions (for forms in the trash) should also be excluded. I don't think something in the trash should cause side effects elsewhere in the project.
Moves #864 forward
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.md as part of this PR.
Before submitting this PR, please make sure you have:
make test-full
and confirmed all checks still pass OR confirm CircleCI build passes