diff options
Diffstat (limited to 'src/hydrilla/proxy/state_impl/_operations/recompute_dependencies.py')
-rw-r--r-- | src/hydrilla/proxy/state_impl/_operations/recompute_dependencies.py | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src/hydrilla/proxy/state_impl/_operations/recompute_dependencies.py b/src/hydrilla/proxy/state_impl/_operations/recompute_dependencies.py index 5403ec3..9419f91 100644 --- a/src/hydrilla/proxy/state_impl/_operations/recompute_dependencies.py +++ b/src/hydrilla/proxy/state_impl/_operations/recompute_dependencies.py @@ -49,21 +49,26 @@ AnyInfoVar = t.TypeVar( def _get_infos_of_type(cursor: sqlite3.Cursor, info_type: t.Type[AnyInfoVar],) \ -> t.Mapping[int, AnyInfoVar]: + join_mapping_statuses = 'JOIN mapping_statuses AS ms USING (item_id)' + condition = "i.type = 'M' AND ms.enabled != 'D'" + if info_type is item_infos.ResourceInfo: + join_mapping_statuses = '' + condition = "i.type = 'R'" + cursor.execute( - ''' + f''' SELECT ive.item_version_id, ive.definition, ive.repo, ive.repo_iteration FROM - item_versions_extra AS ive - JOIN items AS i USING (item_id) - LEFT JOIN mapping_statuses AS ms USING (item_id) + item_versions_extra AS ive + JOIN items AS i USING (item_id) + {join_mapping_statuses} WHERE - i.type = ? AND COALESCE(ms.enabled != 'D', TRUE); - ''', - (info_type.type.value[0].upper(),) + {condition}; + ''' ) result: dict[int, AnyInfoVar] = {} @@ -92,11 +97,14 @@ def _get_current_required_state( cursor.execute( ''' SELECT - definition, repo, repo_iteration + ive.definition, ive.repo, ive.repo_iteration FROM - item_versions_extra + item_versions_extra AS ive + JOIN items AS i USING (item_id) WHERE - item_id NOT IN __unlocked_ids AND active = 'R'; + i.type = 'M' AND + item_id NOT IN __unlocked_ids AND + ive.active = 'R'; ''', ) |