Removed erroneous for loop

This commit is contained in:
aewens 2020-03-16 14:29:53 -05:00
parent 6b5448ad4e
commit 313bb99e94
2 changed files with 26 additions and 27 deletions

View File

@ -1 +1 @@
0.1.10 0.1.11

View File

@ -132,40 +132,39 @@ class Engine:
for (using, mutation) in self._apply_mutations(raw): for (using, mutation) in self._apply_mutations(raw):
for (key, value) in self._get_variables(mutation): for (key, value) in self._get_variables(mutation):
for using_whens in self._whens_map[key]: for using_when in self._whens_map[key]:
for using_when in using_whens: # Already been triggers, skip
# Already been triggers, skip if using_when in skip_whens:
if using_when in skip_whens: continue
continue
when = self._whens.get(using_when) when = self._whens.get(using_when)
if when is None: if when is None:
return None return None
when_requires = requires.get(using_when)
if when_requires is None:
requires[using_when] = set(when._fields)
when_requires = requires.get(using_when) when_requires = requires.get(using_when)
if when_requires is None:
requires[using_when] = set(when._fields)
when_requires = requires.get(using_when)
# Check if all required fields are found # Check if all required fields are found
when_requires.remove(key) when_requires.remove(key)
if len(whens_requires) > 0: if len(whens_requires) > 0:
continue continue
# If all requirements are found, stop checking this # If all requirements are found, stop checking this
skip_whens.add(using_when) skip_whens.add(using_when)
triggered = self._check_when(when) triggered = self._check_when(when)
if not triggered: if not triggered:
continue continue
state = self._states[namespace] state = self._states[namespace]
func = self._whens_funcs.get(when_key) func = self._whens_funcs.get(when_key)
if func is None: if func is None:
return None return None
# Run callback using mutation data and state manager # Run callback using mutation data and state manager
func(data, state) func(data, state)
def _check_when(self, when): def _check_when(self, when):
""" """