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

fix: don't extract the first element from vectors #331

Closed
wants to merge 1 commit into from
Closed

Conversation

satra
Copy link
Contributor

@satra satra commented Aug 2, 2024

this PR attempts to fix the multiple choice selection issue that @ibevers faced.

i'm going to leave this as draft.

@ibevers - you'll need to add a github workflow and config in your repo like the nimh-minimal protocol to be able to use this committish for your UI.

@satra
Copy link
Contributor Author

satra commented Aug 2, 2024

i'm not sure what the piece of code that i changed is doing, hence i need to study the implications a bit. in the meantime, this did not seem to break things (on initial eval).

@fabiocat93
Copy link

Hi @satra, here is my 2 cents. From what I understand, your recent changes help with dropdowns and checkboxes accepting multiple options, but I encountered a new issue. When saving the response to this form:
Screenshot 2024-08-07 at 11 55 50 AM
The expected output should be:

"value": {
    "first_name": "a",
    "middle_name": "b",
    "last_name": "ccccc"
}

However, the actual output is:

"value": {
    "first_name": "a"
}

This is my first time touching the code of rephoschema and I don't have a bigger picture of the code, but it seems that removing the if block entirely it resolves the problem without introducing new issues. Here's the block I'm referring to:

if (_.isObject(val) && !_.isArray(val) && !val.hasOwnProperty('unitCode') && !(val instanceof Blob)) {
    const sectionItemKey = Object.keys(val)[0];
    const sectionItemValue = Object.values(val)[0];
    exportVal = sectionItemValue;
    usedList.push(sectionItemKey);
    isAboutUrl = sectionItemKey;
}

@satra
Copy link
Contributor Author

satra commented Aug 7, 2024

thanks @fabiocat93 - i think we have arrived at the same conclusion for now.

@satra
Copy link
Contributor Author

satra commented Aug 7, 2024

and the example you shared provides a clue to what should perhaps replace that block. i'll take a look. thank you.

@satra
Copy link
Contributor Author

satra commented Aug 9, 2024

closing in favor of #335

@satra satra closed this Aug 9, 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.

2 participants