Skip to content

Commit

Permalink
Merge branch 'release/3.31.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
BelyakovSergey committed Nov 26, 2021
2 parents 7e6397c + f90eb51 commit da5c46d
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 41 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?><Project>
<!-- These properties will be shared for all projects -->
<PropertyGroup>
<VersionPrefix>3.30.0</VersionPrefix>
<VersionPrefix>3.31.0</VersionPrefix>
<VersionSuffix>
</VersionSuffix>
<VersionSuffix Condition=" '$(VersionSuffix)' != '' AND '$(BuildNumber)' != '' ">$(VersionSuffix)-$(BuildNumber)</VersionSuffix>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,47 +37,49 @@ angular.module('virtoCommerce.marketingModule')
let equals = angular.equals(blade.origEntity, blade.currentEntity);
if (equals)
return false;

// Check possibility they are really equivalent but have a different representation of dynamic property value
equals = angular.equals(_.omit(blade.origEntity, ['dynamicProperties']), _.omit(blade.currentEntity, ['dynamicProperties']));
if (!blade.origEntity.dynamicProperties ||
!blade.currentEntity.dynamicProperties ||
!blade.origEntity.dynamicProperties.length ||
!blade.currentEntity.dynamicProperties.length)
return equals;

for (var originalEntityDynamicProperty of blade.origEntity.dynamicProperties) {
let currentEntityDynamicProperty = blade.currentEntity.dynamicProperties.find(x => x.name == originalEntityDynamicProperty.name);

if (originalEntityDynamicProperty.isDictionary) {
// dictionaries comparison
// Case when both orig and current values are empty,
// dictionary field clearing (press 'Backspace') after selection is reason to currentEntityDynamicProperty undefined value.
let currDictionaryValuesIds = currentEntityDynamicProperty.values.filter(x => x.value != undefined).map(x => x.value.id);
// 'Every' func require length check
equals = originalEntityDynamicProperty.values.length
? originalEntityDynamicProperty.values.every(x => currDictionaryValuesIds.includes(x.valueId))
: !currDictionaryValuesIds.length;
}
else if (originalEntityDynamicProperty.isArray) {
// arrays comparison
// Check arrays equality (adding an element after the same element deletation)
let originalValues = originalEntityDynamicProperty.values.map(x => x.value);
let currentValues = currentEntityDynamicProperty.values.map(x => x.value);
equals = originalEntityDynamicProperty.values.length == currentEntityDynamicProperty.values.length && originalValues.every(x => currentValues.includes(x));
} else {
// simple types
currentEntityDynamicProperty.values = originalEntityDynamicProperty.values.length == 0
? currentEntityDynamicProperty.values.filter(x => x.value != '')
: currentEntityDynamicProperty.values;
equals = angular.equals(originalEntityDynamicProperty.values, currentEntityDynamicProperty.values);
else if (blade.origEntity.name !== blade.currentEntity.name || blade.origEntity.description !== blade.currentEntity.description)
return true;
// This validation logic is only needed for dynamic properties
else {
// Check possibility they are really equivalent but have a different representation of dynamic property value
equals = angular.equals(_.omit(blade.origEntity, ['dynamicProperties']), _.omit(blade.currentEntity, ['dynamicProperties']));
if (!blade.origEntity.dynamicProperties ||
!blade.currentEntity.dynamicProperties ||
!blade.origEntity.dynamicProperties.length ||
!blade.currentEntity.dynamicProperties.length)
return equals;

for (var originalEntityDynamicProperty of blade.origEntity.dynamicProperties) {
let currentEntityDynamicProperty = blade.currentEntity.dynamicProperties.find(x => x.name == originalEntityDynamicProperty.name);

if (originalEntityDynamicProperty.isDictionary) {
// dictionaries comparison
// Case when both orig and current values are empty,
// dictionary field clearing (press 'Backspace') after selection is reason to currentEntityDynamicProperty undefined value.
let currDictionaryValuesIds = currentEntityDynamicProperty.values.filter(x => x.value != undefined).map(x => x.value.id);
// 'Every' func require length check
equals = originalEntityDynamicProperty.values.length
? originalEntityDynamicProperty.values.every(x => currDictionaryValuesIds.includes(x.valueId))
: !currDictionaryValuesIds.length;
}
else if (originalEntityDynamicProperty.isArray) {
// arrays comparison
// Check arrays equality (adding an element after the same element deletation)
let originalValues = originalEntityDynamicProperty.values.map(x => x.value);
let currentValues = currentEntityDynamicProperty.values.map(x => x.value);
equals = originalEntityDynamicProperty.values.length == currentEntityDynamicProperty.values.length && originalValues.every(x => currentValues.includes(x));
} else {
// simple types
currentEntityDynamicProperty.values = originalEntityDynamicProperty.values.length == 0
? currentEntityDynamicProperty.values.filter(x => x.value != '')
: currentEntityDynamicProperty.values;
equals = angular.equals(originalEntityDynamicProperty.values, currentEntityDynamicProperty.values);
}
if (!equals)
break;
}

if (!equals)
break;
return !equals;
}

return !equals;
};

blade.initialize = function () {
Expand Down
2 changes: 1 addition & 1 deletion src/VirtoCommerce.MarketingModule.Web/module.manifest
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<module xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<id>VirtoCommerce.Marketing</id>
<version>3.30.0</version>
<version>3.31.0</version>
<version-tag />
<platformVersion>3.81.0</platformVersion>
<title>Marketing module</title>
Expand Down

0 comments on commit da5c46d

Please sign in to comment.