внесено fix

This commit is contained in:
Nikolai 2022-11-02 18:59:28 +06:00
parent 6e4ba40bc4
commit 129edcf29a

@ -475,7 +475,7 @@ const DataGridElement: React.FC<MWProps> = ({ openModal }) => {
discountsArray.forEach( (discount, i) => { discountsArray.forEach( (discount, i) => {
if( i == activeDiscount ) { if( i == activeDiscount ) {
discount.privileges.forEach( (privilege) => { discount.privileges.forEach( (privilege) => {
if( tariff.service == privilege.good ) { //if( tariff.service == privilege.good ) {
if( privilege.discount != 0 ) { if( privilege.discount != 0 ) {
if( fieldAddedValue ) { // внесено if( fieldAddedValue ) { // внесено
@ -497,16 +497,18 @@ const DataGridElement: React.FC<MWProps> = ({ openModal }) => {
if( minI >= 0 ) { if( minI >= 0 ) {
discountsArray[ minI ].privileges.forEach( (y) => { discountsArray[ minI ].privileges.forEach( (y) => {
percents = percents + y.discount / 2; // костыль percents = percents + y.discount / discountsActiveArray.length; // костыль
}); });
} }
} else { // не внесено } else { // не внесено
if( tariff.service == privilege.good ) {
percents = percents + privilege.discount; percents = percents + privilege.discount;
} }
}
} }
} //}
}); });
} }
}); });
@ -538,7 +540,7 @@ const DataGridElement: React.FC<MWProps> = ({ openModal }) => {
if( i == activeDiscount ) { if( i == activeDiscount ) {
discount.privileges.forEach( (privilege) => { discount.privileges.forEach( (privilege) => {
if( item.service == privilege.good ) { //if( item.service == privilege.good ) {
if( privilege.discount != 0 ) { if( privilege.discount != 0 ) {
if( fieldAddedValue ) { // внесено if( fieldAddedValue ) { // внесено
@ -560,22 +562,24 @@ const DataGridElement: React.FC<MWProps> = ({ openModal }) => {
if( minI >= 0 ) { if( minI >= 0 ) {
discountsArray[ minI ].privileges.forEach( (y) => { discountsArray[ minI ].privileges.forEach( (y) => {
percents = percents + y.discount / 2; // костыль percents = percents + y.discount / discountsActiveArray.length; // костыль
}); });
} }
} else { // не внесено } else { // не внесено
if( item.service == privilege.good ) {
percents = percents + privilege.discount; percents = percents + privilege.discount;
} }
}
}
});
}
});
});
} }
}
//}
});
}
});
});
}
console.log(percents)
price = price - (price * percents); price = price - (price * percents);
} }