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

Add sync_kobocat_form_media management command #3226

Merged
merged 22 commits into from
Jun 10, 2021
Merged

Conversation

joshuaberetta
Copy link
Member

@joshuaberetta joshuaberetta commented May 19, 2021

sync_kobocat_form_media

The sync_kobocat_form_media command can take several optional arguments:

  • --username: string (default None),
  • --asset-uid: string (default None),
  • --verbosity, int in {0, 1, 2, 3} (default 1), and
  • --quiet: bool (default False)

With those arguments, the following behaviour can be expected:

  • no arguments: all deployed KPI Assets will attempt to sync;
  • username: only the assets that the user owns will have their media synced;
  • asset_uid: only the asset with the UID provided will sync;
  • verbosity:
    • 0 or 1: minimal output stats,
    • 2: an array containing stats for each asset sync included,
    • 3: an additional array with the filenames and IDs that have been synced
  • quiet: no output

sync_kobocat_xforms

Since sync_kobocat_form_media will only sync for assets that exist in KPI, sync_kobocat_xforms can now be run with the additional argument of --sync-form-media (defaults to True, run with --no-sync-form-media to turn off) when a username is provided. This will sync that user's forms from kobocat to KPI while additionally syncing the form-media from kobocat.

The /migrate endpoint will now also call sync_kobocat_xforms with the option of sync_kobocat_form_media set to True.

Description

Management command, sync_kobocat_form_media, created to allow for form-media from kobocat to be synced with KPI's replacement model.

Related issues

closes #2675

@joshuaberetta joshuaberetta linked an issue May 19, 2021 that may be closed by this pull request
@joshuaberetta joshuaberetta added Back end enhancement Ideas, improvements and features high priority To be done soon labels May 19, 2021
@joshuaberetta joshuaberetta requested a review from noliveleger May 19, 2021 23:08
@joshuaberetta joshuaberetta marked this pull request as ready for review May 20, 2021 15:46
@joshuaberetta joshuaberetta requested a review from noliveleger May 26, 2021 19:20
Base automatically changed from 2487-form-media-alphabetized-methods to 2487-form-media June 2, 2021 18:37
Base automatically changed from 2487-form-media to beta June 3, 2021 15:45
@noliveleger
Copy link
Contributor

@joshuaberetta I think I would rename the management command sync_kobocat_form_media to be consistent with sync_kobocat_xforms

@joshuaberetta joshuaberetta changed the title Add sync_form_media management command Add sync_kobocat_form_media management command Jun 10, 2021
@noliveleger noliveleger merged commit a7f4721 into beta Jun 10, 2021
@noliveleger noliveleger deleted the 2675-sync-form-media branch June 10, 2021 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Back end enhancement Ideas, improvements and features high priority To be done soon
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fetch old form media from KoBoCAT
2 participants