Skip to content
This repository has been archived by the owner on Mar 8, 2020. It is now read-only.

Fix for optional values being added without overwriting previous entries (Issue 1816) #2322

Merged
merged 6 commits into from
Oct 31, 2017

Conversation

awjh-ibm
Copy link
Contributor

@awjh-ibm awjh-ibm commented Oct 9, 2017

#1816

Fix to keep user's previously entered data for fields when the user ticks the optional data checkbox. Optional data is discarded when box is unticked to match possible solution 3 of the issue.

Work performed:

  • Added function to go through the optional data JSON and existing data JSON and use values from existing data for the key of the optional data, including treating each key in sub objects individually.
  • Wrote tests to test new function worked and that existing functions called it when needed.
  • Manually verified functionality in local build of playground

Copy link
Contributor

@cazfletch cazfletch left a comment

Choose a reason for hiding this comment

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

When i press the generate random data button nothing happens

Signed-off-by: awjh-ibm <andrew.hurt1@ibm.com>
@awjh-ibm
Copy link
Contributor Author

Updated code to fix generate code issue

@awjh-ibm awjh-ibm dismissed cazfletch’s stale review October 11, 2017 14:10

Changes requested have since been committed

@cazfletch
Copy link
Contributor

@awjh-ibm can you fix the conflicts please?

@cazfletch cazfletch self-requested a review October 18, 2017 13:14
Copy link
Contributor

@cazfletch cazfletch left a comment

Choose a reason for hiding this comment

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

@awjh-ibm i'd expect this to work for non optional properties too. So if i enter some data then press the generate random button i'd expect the properties i have already set to keep their values too not just optional ones

Copy link
Contributor

@cazfletch cazfletch left a comment

Choose a reason for hiding this comment

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

If you show the optional properties then generate random data, then edit one of the optional properties, then generate random data, the property changed previosuly will be overwriten

@bestbeforetoday
Copy link
Contributor

bestbeforetoday commented Oct 27, 2017

@caroline-church Note that this issue is not intended to change the behaviour of random data generation; just the behaviour of ticking and un-ticking the Optional properties checkbox. See the discussion in #1816

To recap, the behaviour suggested is simply:

Ticking the Optional Properties checkbox adds any missing optional properties, using "empty" values; existing property values are left unchanged. Unticking the checkbox removes any optional properties that have been defined.

@cazfletch
Copy link
Contributor

cazfletch commented Oct 27, 2017 via email

Signed-off-by: awjh-ibm <andrew.hurt1@ibm.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

5 participants