Skip to content

Commit

Permalink
Updates store and category-toolgroup component
Browse files Browse the repository at this point in the history
  • Loading branch information
rmanaem committed Aug 14, 2024
1 parent 514a580 commit 6a905c8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
4 changes: 2 additions & 2 deletions components/category-toolgroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<v-select
v-if="tableRows.length > 0"
data-cy="toolgroup-select"
:options="toolTerms"
:options="measurementTerms"
outlined
@input="selectTool"
:selectable="(option) => !getSelectedTools.some(el => el.identifier.includes(option.identifier))"
Expand Down Expand Up @@ -80,7 +80,7 @@
...mapState([
"toolTerms",
"measurementTerms",
"columnToToolMap"
]),
tableRows() {
Expand Down
13 changes: 7 additions & 6 deletions store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { Set } from "core-js";
import Vue from "vue";
import toolTerms from "~/static/toolTerms.json";
import measurementTerms from "~/static/refactoredmeasurementTerms.json";
import diagnosisTerms from "~/static/diagnosisTerms.json";

export const state = () => ({
Expand Down Expand Up @@ -150,9 +151,9 @@ export const state = () => ({
}
},

toolTerms: Object.entries(toolTerms).map(([key, value]) => ({
measurementTerms: Object.entries(measurementTerms).map(([key, value]) => ({
label: value,
identifier: "cogatlas:" + key,
identifier: key,
selected: false
})),

Expand Down Expand Up @@ -183,7 +184,7 @@ export const getters = {
};
const tool = p_state.columnToToolMap[p_columnName];

p_state.toolTerms.forEach(term => {
p_state.measurementTerms.forEach(term => {
if ( term.identifier === tool ) {
formattedOutput.Annotations.IsPartOf.Label = term.label;
formattedOutput.Annotations.IsPartOf.TermURL = term.identifier;
Expand Down Expand Up @@ -546,7 +547,7 @@ export const getters = {
},

getSelectedTools: (p_state) => {
return p_state.toolTerms.filter(term => term.selected);
return p_state.measurementTerms.filter(term => term.selected);
},

getTransformOptions: (p_state) => (p_category) => {
Expand Down Expand Up @@ -788,8 +789,8 @@ export const mutations = {
},

createAssessmentTool(p_state, newTool) {
const toolIndex = p_state.toolTerms.findIndex(tool => tool.identifier === newTool.identifier);
p_state.toolTerms.splice(toolIndex, 1, Object.assign(p_state.toolTerms[toolIndex], { selected: true }));
const toolIndex = p_state.measurementTerms.findIndex(tool => tool.identifier === newTool.identifier);
p_state.measurementTerms.splice(toolIndex, 1, Object.assign(p_state.measurementTerms[toolIndex], { selected: true }));
},

initializeColumnToCategoryMap(p_state, p_columns) {
Expand Down

0 comments on commit 6a905c8

Please sign in to comment.