Skip to content

Commit

Permalink
[#157] Update load answer.value on FE
Browse files Browse the repository at this point in the history
  • Loading branch information
wayangalihpratama committed Aug 9, 2023
1 parent 5013fd9 commit efb4d7a
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions frontend/src/components/maps/Map.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ const Map = ({ searchValue }) => {
return [];
}
return remapDataWithInitData.filter(
(d) => !selectedOption.includes(d.answer.value)
(d) => !selectedOption.includes(d.answer)
);
}
return remapDataWithInitData;
Expand All @@ -299,14 +299,13 @@ const Map = ({ searchValue }) => {
if (["option", "jmp"].includes(selectedQuestion.type)) {
let results = Object.values(
mapData.reduce((obj, item) => {
obj[item.answer.value] = obj[item.answer.value] || {
name: item.answer.value,
color: selectedQuestion?.option?.find(
(f) => f.name === item.answer.value
)?.color,
obj[item.answer] = obj[item.answer] || {
name: item.answer,
color: selectedQuestion?.option?.find((f) => f.name === item.answer)
?.color,
count: 0,
};
obj[item.answer.value].count++;
obj[item.answer].count++;
return obj;
}, {})
);
Expand Down Expand Up @@ -561,7 +560,7 @@ const Markers = ({
className: "custom-marker",
iconSize: [32, 32],
html: `<span style="background-color:${
selectedQuestion?.option?.find((f) => f.name === answer?.value)
selectedQuestion?.option?.find((f) => f.name === answer)
?.color || "#2EA745"
}; border:${isHovered ? "2px solid #fff" : ""};"/>`,
})
Expand Down Expand Up @@ -618,9 +617,9 @@ const createClusterCustomIcon = (cluster) => {
.getAllChildMarkers()
.map((item) => {
return {
...item?.options?.answerValue,
value: item?.options?.answerValue,
color: item?.options?.selectedQuestion?.option?.find(
(f) => f.name === item?.options?.answerValue?.value
(f) => f.name === item?.options?.answerValue
)?.color,
};
})
Expand Down

0 comments on commit efb4d7a

Please sign in to comment.