Skip to content

Commit

Permalink
Merge #4025 Recommendations usability improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Feb 14, 2024
2 parents 2c937f3 + fbce036 commit 2271c36
Show file tree
Hide file tree
Showing 15 changed files with 255 additions and 73 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file.
- [Updater] Support dev builds for auto updater (#3997, #4008 by: HebaruSan)
- [GUI] Sort mods satisfying the same recommendation by download count (#4007 by: HebaruSan)
- [Multiple] Alternate game command lines and Steam refactor (#4010, #4013 by: HebaruSan)
- [Multiple] Recommendations usability improvements (#4025 by: HebaruSan)

### Bugfixes

Expand Down
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 @@ private void DownloadModules(IEnumerable<CkanModule> mods, IDownloader downloade
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 2271c36

Please sign in to comment.