Skip to content

Commit

Permalink
Recommendations usability improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Feb 14, 2024
1 parent 2c937f3 commit fbce036
Show file tree
Hide file tree
Showing 14 changed files with 254 additions and 73 deletions.
15 changes: 12 additions & 3 deletions Core/ModuleInstaller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1343,12 +1343,21 @@ public bool FindRecommendations(HashSet<CkanModule>
registry, crit);
var recommenders = resolver.Dependencies().ToHashSet();

var checkedRecs = resolver.Recommendations(recommenders)
.Where(m => resolver.ReasonsFor(m)
.Any(r => (r as SelectionReason.Recommended)?.ProvidesIndex == 0))
.ToHashSet();
var conflicting = new RelationshipResolver(toInstall.Concat(checkedRecs), null,
RelationshipResolverOptions.ConflictsOpts(),
registry, crit)
.ConflictList.Keys;
// Don't check recommendations that conflict with installed or installing mods
checkedRecs.ExceptWith(conflicting);

recommendations = resolver.Recommendations(recommenders)
.ToDictionary(m => m,
m => new Tuple<bool, List<string>>(
resolver.ReasonsFor(m)
.Any(r => (r as SelectionReason.Recommended)
?.ProvidesIndex == 0),
checkedRecs.Contains(m),
resolver.ReasonsFor(m)
.Where(r => r is SelectionReason.Recommended rec
&& recommenders.Contains(rec.Parent))
Expand Down
9 changes: 9 additions & 0 deletions Core/Relationships/RelationshipResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,15 @@ public static RelationshipResolverOptions KitchenSinkOpts()
get_recommenders = true,
};

public static RelationshipResolverOptions ConflictsOpts()
=> new RelationshipResolverOptions()
{
without_toomanyprovides_kraken = true,
proceed_with_inconsistencies = true,
without_enforce_consistency = true,
with_recommends = false,
};

/// <summary>
/// If true, add recommended mods, and their recommendations.
/// </summary>
Expand Down
106 changes: 88 additions & 18 deletions GUI/Controls/ChooseRecommendedMods.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fbce036

Please sign in to comment.