Skip to content

Commit

Permalink
Fix issue when updating game support on multiple dependers
Browse files Browse the repository at this point in the history
  • Loading branch information
rubenwardy committed Jun 23, 2024
1 parent 0c4698e commit e518c86
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions app/logic/game_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,6 @@ def on_update(self, package: GSPackage, old_provides: Optional[set[str]] = None)
while len(to_update) > 0:
current_package = to_update.pop()
if current_package.id_ in self.packages and current_package.type != PackageType.GAME:
current_package.is_confirmed = False
current_package.detected_supported_games = []
self._get_supported_games(current_package, [])

provides = current_package.provides
Expand All @@ -239,6 +237,10 @@ def on_update(self, package: GSPackage, old_provides: Optional[set[str]] = None)
for modname in provides:
for depending_package in self.get_all_that_depend_on(modname):
if depending_package not in checked:
if depending_package.id_ in self.packages and depending_package.type != PackageType.GAME:
depending_package.is_confirmed = False
depending_package.detected_supported_games = []

to_update.add(depending_package)
checked.add(depending_package)

Expand Down
6 changes: 3 additions & 3 deletions app/tests/unit/logic/test_game_support.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def test_update_new_mod():
support = GameSupport()
support.add(make_game("game1", ["default"]))
support.add(make_game("game2", ["core", "mod_b"]))
lib = support.add(make_mod("lib", ["lib"], []))
lib = support.add(make_mod("lib", ["lib"], ["mod_b"]))
modA = support.add(make_mod("mod_a", ["mod_a"], ["mod_b", "lib"]))
support.on_update(modA)

Expand All @@ -294,7 +294,7 @@ def test_update_new_mod():
assert modA.detected_supported_games == {"game2"}

assert lib.is_confirmed
assert len(lib.detected_supported_games) == 0
assert lib.detected_supported_games == {"game2"}

modB = support.add(make_mod("mod_b", ["mod_b"], ["default"]))
support.on_update(modB)
Expand All @@ -308,7 +308,7 @@ def test_update_new_mod():
assert modB.detected_supported_games == {"game1"}

assert lib.is_confirmed
assert len(lib.detected_supported_games) == 0
assert lib.detected_supported_games == {"game1", "game2"}


def test_update_remove_mod():
Expand Down

0 comments on commit e518c86

Please sign in to comment.