Skip to content

Commit

Permalink
Fix Tag Filter conditions not being serialized into DB. Fix case matc…
Browse files Browse the repository at this point in the history
…hing of tag filters
  • Loading branch information
da3dsoul committed Jul 28, 2018
1 parent 60e27d1 commit e3cd600
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Shoko.Server/Repositories/Cached/GroupFilterRepository.cs
Expand Up @@ -617,7 +617,7 @@ public void CalculateAnimeSeriesPerTagGroupFilter(ISessionWrapper session)
}
});

var lookup = somethingDictionary.Keys.Where(a => somethingDictionary[a] != null).ToDictionary(key => key, key =>
var lookup = somethingDictionary.Keys.Where(a => somethingDictionary[a] != null).ToDictionary(key => key, key =>
somethingDictionary[key].Where(a => a.Value != null)
.SelectMany(p => p.Value.Select(a => Tuple.Create(p.Key, a)))
.ToLookup(p => p.Item1, p => p.Item2));
Expand Down Expand Up @@ -670,13 +670,13 @@ private void CreateAllTagFilters(ISessionWrapper session, SVR_GroupFilter tagsdi
SortingCriteria = "5;1",
FilterType = (int) GroupFilterType.Tag,
};
yf.SeriesIds[0] = lookup[0][s].ToHashSet();
yf.SeriesIds[0] = lookup[0][s.ToLowerInvariant()].ToHashSet();
yf.GroupsIds[0] = yf.SeriesIds[0]
.Select(id => RepoFactory.AnimeSeries.GetByID(id).TopLevelAnimeGroup?.AnimeGroupID ?? -1)
.Where(id => id != -1).ToHashSet();
foreach (var user in users)
{
yf.SeriesIds[user.JMMUserID] = lookup[user.JMMUserID][s].ToHashSet();
yf.SeriesIds[user.JMMUserID] = lookup[user.JMMUserID][s.ToLowerInvariant()].ToHashSet();
yf.GroupsIds[user.JMMUserID] = yf.SeriesIds[user.JMMUserID]
.Select(id => RepoFactory.AnimeSeries.GetByID(id).TopLevelAnimeGroup?.AnimeGroupID ?? -1)
.Where(id => id != -1).ToHashSet();
Expand All @@ -698,6 +698,8 @@ private void CreateAllTagFilters(ISessionWrapper session, SVR_GroupFilter tagsdi
};
yf.Conditions.Add(gfc);
yf.UpdateEntityReferenceStrings();
yf.GroupConditions = Newtonsoft.Json.JsonConvert.SerializeObject(yf._conditions);
yf.GroupConditionsVersion = SVR_GroupFilter.GROUPCONDITIONS_VERSION;
toAdd.Add(yf);
}

Expand Down

0 comments on commit e3cd600

Please sign in to comment.