fix selectRegistration filter

This commit is contained in:
vchikalkin 2021-07-20 15:22:09 +03:00
parent aeb549be6b
commit fe18089cd4

View File

@ -358,14 +358,18 @@ const gibddReactions: IReactionEffect[] = [
}) => {
calculationStore.setFilter('selectRegistration', options =>
options.filter(x => {
if (!(x.evo_whom_register === objectRegistration)) {
if (!objectRegionRegistration && !regionRegistration) {
return false;
}
if (!(x?.evo_whom_register === objectRegistration)) {
return false;
}
if (
!(
x.evo_gibdd_region ===
(objectRegionRegistration.evo_regionid === regionRegistration)
x?.evo_gibdd_region ===
(objectRegionRegistration?.evo_regionid === regionRegistration)
)
) {
return false;
@ -373,23 +377,26 @@ const gibddReactions: IReactionEffect[] = [
if (
(typePTS &&
(!x.evo_pts_type ||
x.evo_pts_type.filter(t => t > 0).length === 0)) ||
x.evo_pts_type?.filter(t => t > 0).includes(typePTS) === false
(!x?.evo_pts_type ||
x?.evo_pts_type.filter(t => t > 0).length === 0)) ||
x?.evo_pts_type?.filter(t => t > 0).includes(typePTS) === false
) {
return false;
}
if (!x.evo_accountid) {
if (!x?.evo_accountid) {
return true;
}
return objectRegionRegistration.accounts
.map(r => r.accountid)
return objectRegionRegistration?.accounts
?.map(r => r.accountid)
.includes(x.evo_accountid);
}),
);
},
options: {
fireImmediately: true,
},
}),
(calculationStore, calculationProcess) => ({