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

Conversation

viktorvanwijk
Copy link
Contributor

@viktorvanwijk viktorvanwijk commented Feb 7, 2025

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

All modified and coverable lines are covered by tests ✅

Project coverage is 96.75%. Comparing base (47c74d6) to head (c47324c).
Report is 12 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5094   +/-   ##
=======================================
  Coverage   96.74%   96.75%           
=======================================
  Files         771      774    +3     
  Lines       26636    26657   +21     
  Branches     3467     3468    +1     
=======================================
+ Hits        25770    25791   +21     
  Misses        605      605           
  Partials      261      261           

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

@viktorvanwijk viktorvanwijk force-pushed the bug/5087-fixed-metadata-variables-are-not-shown-in-options-of-json-dump-registration-backend branch 3 times, most recently from bbc2a0c to ac916d9 Compare February 10, 2025 12:45
@viktorvanwijk viktorvanwijk marked this pull request as ready for review February 10, 2025 14:35
@viktorvanwijk viktorvanwijk requested a review from vaszig February 11, 2025 09:33
Copy link
Contributor

@vaszig vaszig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not completely familiar with the feature but this looks ok to me.

Having read the possible approaches you mention in the issue itself, I agree with the one that you selected. I don't know though if there was another solution that doesn't come to my mind now.

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 23d2918 to c47324c Compare February 13, 2025 14:44
@robinmolen robinmolen merged commit 62ce1d4 into master Feb 17, 2025
33 checks passed
@robinmolen robinmolen deleted the bug/5087-fixed-metadata-variables-are-not-shown-in-options-of-json-dump-registration-backend branch February 17, 2025 15:17
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
3 participants