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

feat: leave previous answers intact when skipping question #1582

Closed

Conversation

stereobutter
Copy link
Contributor

With this PR skipping questions using a falsy when doesn't modify the answers file anymore. This enables the usage of when: "{{answer is not defined}}" to only ask a question on copier copy and skip the question on any future copier update while keeping the original answer recorded.

# copier.yaml
year_of_first_publication:
    type: str
    when: "{{year_of_first_publication is not defined}}"

resolves #1574

Previously a falsy `when` invariably hid the answer from the answer file, effectively deleting a potential previous answer when the question is skipped. Now a falsy when does not modify the answer file leaving any potential previous answers intact.
Copy link

codecov bot commented Apr 14, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.30%. Comparing base (eeeebc3) to head (1118ba2).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1582   +/-   ##
=======================================
  Coverage   97.29%   97.30%           
=======================================
  Files          48       48           
  Lines        4621     4636   +15     
=======================================
+ Hits         4496     4511   +15     
  Misses        125      125           
Flag Coverage Δ
unittests 97.30% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@stereobutter
Copy link
Contributor Author

Oh and I also tried to make the docs for when a little bit clearer with regards to what skipping a question actually means (under the new behaviour this PR introduces).

@sisp
Copy link
Member

sisp commented Apr 14, 2024

Thanks for your initiative, @stereobutter! 🙏 Unfortunately, I don't think this idea works – see #1574 (comment). Let's keep the discussion there for now until we have a working design proposal.

@yajo
Copy link
Member

yajo commented Apr 20, 2024

Thanks for your efforts @stereobutter! 😊 I'll close this pr to keep our list clean, because there have been hopefully better solutions proposed in the issue. Let's continue there until we reach consensus.

@yajo yajo closed this Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improved logic for when for handling initial questions
3 participants