Filter compatible modules by compatibility #2980
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
When you check the mod list checkbox to install a mod, the latest version is chosen regardless of compatibility:
Cause
In #2963 we renamed
Registry.Available
toRegistry.CompatibleModules
and rewrote it to share a persistent data structure withRegistry.IncompatibleModules
that stores all the compatibleAvailableModule
s in one list and the incompatible ones in another list. Then all we have to do is return oneCkanModule
perAvailableModule
in a list.Previously we returned the latest
CkanModule
regardless of its compatibility. This meant that when aGUIMod
got constructed for a given row, itsMod
property could be set to an incompatibleCkanModule
, and this is what is used for the default version to install.Changes
Now we pass the version criteria to
AvailableModule.Latest()
when generating the list ofCkanModule
s, so the list will contain actually compatible modules. This will allowGUIMod
to select the correctMod
value.(And
pair
is renamed toavail
since these areAvailableModule
objects rather than theKeyValuePair
s that we would commonly see when working with a dictionary.)Fixes #2979.