Fix AssertionError on RetryDataImport and optimize SQL queries
Closes #789 (closed)
This additionally adds a missing test case for workflows in a pending
state, and optimizes the SQL queries in most calls to RetryDataImport:
- Retrying a process with a workflow successfully: 28 → 15 queries
- Retrying a process without a workflow successfully: 21 → 17 queries
- Retrying a process that cannot be retried:
- In an Unscheduled or Pending state: 10 → 7 queries
- In a Running state: 13 → 7 queries
Edited by Erwan Rouchet