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 API endpoint for default fixed metadata variables of JSON dump plugin #5094

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

viktorvanwijk
Copy link
Contributor

Closes #5087

Changes

Add API endpoint for default fixed metadata variables of JSON dump plugin.

Checklist

Check off the items that are completed or not relevant.

  • Impact on features

    • Checked copying a form
    • Checked import/export of a form
    • Config checks in the configuration overview admin page
    • Problem detection in the admin email digest is handled
  • Release management

    • I have labelled the PR as "needs-backport" accordingly
  • I have updated the translations assets (you do NOT need to provide translations)

    • Ran ./bin/makemessages_js.sh
    • Ran ./bin/compilemessages_js.sh
  • Dockerfile/scripts

    • Updated the Dockerfile with the necessary scripts from the ./bin folder
  • Commit hygiene

    • Commit messages refer to the relevant Github issue
    • Commit messages explain the "why" of change, not the how

Copy link

codecov bot commented Feb 7, 2025

Codecov Report

Attention: Patch coverage is 80.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 96.74%. Comparing base (47c74d6) to head (1ab81fd).

Files with missing lines Patch % Lines
...forms/registrations/contrib/json_dump/api/views.py 66.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5094      +/-   ##
==========================================
- Coverage   96.74%   96.74%   -0.01%     
==========================================
  Files         771      773       +2     
  Lines       26636    26646      +10     
  Branches     3467     3467              
==========================================
+ Hits        25770    25778       +8     
- Misses        605      607       +2     
  Partials      261      261              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Because the initial value of fixed metadata variables is set to an empty list and the fixed metadata variables field in the serializer was not set to read only, they would be overwritten when saving the form, resulting in a permanent empty list of fixed variables.

This fix adds an API endpoint to fetch the default fixed variables dynamically in the frontend. This means they will be available directly when setting up the plugin for the first time.
…ables table of JSON dump plugin

If the JSON dump plugin was not completely initialized yet (selected but not saved), and the user navigated to the registration variables of the variables table, the backend options would be an empty object, causing a crash.
@viktorvanwijk viktorvanwijk force-pushed the bug/5087-fixed-metadata-variables-are-not-shown-in-options-of-json-dump-registration-backend branch from 44022b8 to 1ab81fd Compare February 7, 2025 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fixed metadata variables are not shown in options of JSON dump registration backend
1 participant