Skip to content

Commit

Permalink
do not overwrite dependency rules on format
Browse files Browse the repository at this point in the history
Signed-off-by: Vinzenz Rosenkranz <[email protected]>
  • Loading branch information
v1r0x committed Dec 13, 2024
1 parent 2e4b6bc commit 55fb812
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions resources/js/components/modals/attribute/Edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -402,9 +402,13 @@
!!rule.value;
};
const formatDependency = dependencyRules => {
const formattedRules = {};
formattedRules.union = !!dependencyRules?.union;
if(dependencyRules.groups) {
dependencyRules.groups = dependencyRules.groups.map(group => {
group.rules = group.rules.map(rule => {
formattedRules.groups = dependencyRules.groups.map(group => {
const formattedGroup = {};
formattedGroup.union = group.union;
formattedGroup.rules = group.rules.map(rule => {
const converted = {
attribute: null,
operator: null,
Expand All @@ -415,18 +419,16 @@
converted.value = rule.value;
return converted;
});
return group;
return formattedGroup;
});
} else if(Object.keys(dependencyRules).length == 0) {
dependencyRules = {
union: false,
groups: [{
union: true,
rules: [],
}],
};
formattedRules.union = false;
formattedRules.groups = [{
union: true,
rules: [],
}];
}
return dependencyRules;
return formattedRules;
};
const confirmEdit = _ => {
const data = {
Expand Down

0 comments on commit 55fb812

Please sign in to comment.