-
-
Notifications
You must be signed in to change notification settings - Fork 186
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
feat(projectHistoryLogs): record project history logs for imports TASK-944 #5230
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Base automatically changed from
rsgraber/TASK-944-rest-service-changes
to
main
November 6, 2024 15:49
811a639
to
faee2d1
Compare
b71ddbf
to
47cf3c2
Compare
Guitlle
approved these changes
Nov 10, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📣 Summary
Record every time a user replaces the form on a survey via an import
👀 Preview steps
Form
->...
->Download XLS
and save the file as 'MyProject.xls'XLSForm_Settings.xlsx
Form
and click the 'Replace Form' iconUpload an XLS form
and upload MyProject.xlsapi/v2/audit-logs/?q=metadata__asset_uid:<asset uid> AND log_type='project-history'
replace-form
(order doesn't matter) and the usual metadata pluslatest_version_uid
.Replace Form
again and upload XLSForm_Settings.xlsx. This should change the title of the project.update-name
and the other with action=replace-form
(order doesn't matter). The log metadata should have all the information as the previous one. Theupdate-name
log should additionally haveImport an XLS from via URL
replace-form
log and a newupdate-name
log.💭 Notes
Several things in this PR
ImportTask._run_task
to record details about the asset being updated in themessages
fieldimport_in_background
to return the uid of the task, which will be sent asresult
in thetask_success
signaltask_success
that fetches the ImportTask from the uid and calls a new method in ProjectHistoryLog to create a log (or several) from itreplace-form
log and possibly anupdate-name
log if the name was changed by the importlog_subtype
to the fields validated in_check_common_metadata
asset_with_settings_and_qa
fixture to make it easier to distinguish from other assetsThe unit tests are a little redundant, but they are meant to check slightly different things. The ones in
test_project_history_logs
test the whole flow. The ones intest_models
test that we know how to make logs from import tasks after they run. The ones intest_api_imports
check that the import tasks are storing the correct information.