Skip to content

Commit

Permalink
Fix reading description from user dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
surchs committed Nov 10, 2023
1 parent 550defc commit c5c69f9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions cypress/fixtures/examples/good/example.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
"sex": {
"Description": "sex of the participant as reported by the participant",
"Levels": {
"M": "male",
"F": "female"
"1": "male",
"2": "female"
}
},
"group": {
Expand Down
8 changes: 2 additions & 6 deletions cypress/unit/store-getter-getValueDescription.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@ const state = {
annotated: {
"goodColumn": {
"Levels": {
"value1": {
"Description": "my description"
},
"value2": {
"Description": "my other description"
"value1": "my description",
"value2": "my other description"
}
}
},
"levelsButNothingElse": {
"Levels": {
Expand Down
2 changes: 1 addition & 1 deletion store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ export const getters = {
getValueDescription: (p_state) => (p_columnName, p_value) => {
// Returns the description of a value in a column, if that description exists
// Otherwise it returns an empty string
const description = p_state.dataDictionary.annotated[p_columnName].Levels?.[p_value]?.Description;
const description = p_state.dataDictionary.annotated[p_columnName].Levels?.[p_value];
if ( typeof description === "undefined" ) {
return "no description available";
}
Expand Down

0 comments on commit c5c69f9

Please sign in to comment.