Let be:
A = mainFlag
B = form.opt1 == store.opt1 and form.opt2 == store.opt2 and
form.opt3 == store.opt3 and form.opt4 == store.opt4
C = form.opt5 == store.opt5 and form.opt6 == store.opt6
Where A
,B
,C
are boolean variables. Then, your IF
statement has the following boolean expression into it: !A*B + A*B*C
Once simplified, this expression leads us to:
!A*B + A*B*C = B*(!A+A*C) = B*((!A+A)*(!A+C)) = B*(!A+C)
(!
,*
,+
are boolean operators for NOT
,AND
and OR
respectively)
Translating this back to your IF statement:
if (
( form.opt1 == store.opt1 and form.opt2 == store.opt2 and /* */
form.opt3 == store.opt3 and form.opt4 == store.opt4 /* B */
)
and
( /* !A */
!mainFlag or (
form.opt5 == store.opt5 and form.opt6 == store.opt6 /* C */
)
)
)
dataHasBeenUpdated = False;
else
dataHasBeenUpdated = True;