| Conditions | 5 |
| Total Lines | 20 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | # -*- coding: utf-8 -*- |
||
| 11 | def guard_activate(analysis_service): |
||
| 12 | """Returns whether the transition activate can be performed for the |
||
| 13 | analysis service passed in |
||
| 14 | """ |
||
| 15 | calculation = analysis_service.getCalculation() |
||
| 16 | if not calculation: |
||
| 17 | return True |
||
| 18 | |||
| 19 | # If the calculation is inactive, we cannot activate the service |
||
| 20 | if not api.is_active(calculation): |
||
| 21 | return False |
||
| 22 | |||
| 23 | # All services that we depend on to calculate our result are active or we |
||
| 24 | # don't depend on other services. |
||
| 25 | dependencies = calculation.getDependentServices() |
||
| 26 | for dependency in dependencies: |
||
| 27 | if not api.is_active(dependency): |
||
| 28 | return False |
||
| 29 | |||
| 30 | return True |
||
| 31 | |||
| 43 |