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

Changed calculateSpace to fix order of discrete and continuous variables #88

Merged
merged 2 commits into from
Jul 26, 2021

Conversation

AkselObdrup
Copy link
Contributor

Changed calculateSpace to fix order of discrete and continuous variables. With this solution they are returned in the same order as they were inputted and correspond to the headers in the frontend

@AkselObdrup AkselObdrup added the bug Something isn't working label Jul 22, 2021
@AkselObdrup AkselObdrup requested a review from j-or July 22, 2021 10:40
@AkselObdrup AkselObdrup self-assigned this Jul 22, 2021
@AkselObdrup AkselObdrup linked an issue Jul 22, 2021 that may be closed by this pull request

const numerical: SpaceType = experiment.valueVariables.map(v => { if(v.discrete) {
return {type: "discrete", name: v.name, from: Number(v.minVal), to: Number(v.maxVal)}}
else {return {type: "continuous", name: v.name, from: Number(v.minVal), to: Number(v.maxVal)}} })
Copy link
Contributor

Choose a reason for hiding this comment

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

Could be simplified a little by only having one return since both objects are very similar...

const type = v.discrete ? "discrete" : "continuous"
return {type, name: v.name, from: Number(v.minVal), to: Number(v.maxVal)}

...if you prefer. But yours works fine too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is definitely more elegant. Thanks for the suggestion, it is very helpful for me :) I will make an update before merging

@AkselObdrup AkselObdrup merged commit 7b3e2ec into main Jul 26, 2021
@j-or j-or deleted the bugfix/variablesorder branch July 26, 2021 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Discrete variables send before continuous variables to API
2 participants