Skip to content

Commit

Permalink
Fix syntax in WithAnime queries in AnimeEpisodeRepository, also fix…
Browse files Browse the repository at this point in the history
… typo
  • Loading branch information
harshithmohan committed Nov 27, 2023
1 parent ad390c8 commit aa983e4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Shoko.Server/Repositories/Cached/AnimeEpisodeRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,9 @@ public List<SVR_AnimeEpisode> GetByHash(string hash)
}

private const string IgnoreVariationsWithAnimeQuery =
@"SELECT ani.EpisodeID FROM VideoLocal AS vl JOIN CrossRef_File_Episode ani ON vl.Hash = ani.Hash WHERE ani.AnimeID == :animeID AND vl.IsVariation = 0 AND vl.Hash != '' GROUP BY ani.EpisodeID HAVING COUNT(ani.EpisodeID) > 1";
private const string CountVariationsAithAnimeQuery =
@"SELECT ani.EpisodeID FROM VideoLocal AS vl JOIN CrossRef_File_Episode ani ON vl.Hash = ani.Hash WHERE ani.AnimeID == :animeID AND vl.Hash != '' GROUP BY ani.EpisodeID HAVING COUNT(ani.EpisodeID) > 1";
@"SELECT ani.EpisodeID FROM VideoLocal AS vl JOIN CrossRef_File_Episode ani ON vl.Hash = ani.Hash WHERE ani.AnimeID = :animeID AND vl.IsVariation = 0 AND vl.Hash != '' GROUP BY ani.EpisodeID HAVING COUNT(ani.EpisodeID) > 1";
private const string CountVariationsWithAnimeQuery =
@"SELECT ani.EpisodeID FROM VideoLocal AS vl JOIN CrossRef_File_Episode ani ON vl.Hash = ani.Hash WHERE ani.AnimeID = :animeID AND vl.Hash != '' GROUP BY ani.EpisodeID HAVING COUNT(ani.EpisodeID) > 1";
private const string IgnoreVariationsQuery =
@"SELECT ani.EpisodeID FROM VideoLocal AS vl JOIN CrossRef_File_Episode ani ON vl.Hash = ani.Hash WHERE vl.IsVariation = 0 AND vl.Hash != '' GROUP BY ani.EpisodeID HAVING COUNT(ani.EpisodeID) > 1";
private const string CountVariationsQuery =
Expand All @@ -106,7 +106,7 @@ public List<SVR_AnimeEpisode> GetWithSoftDuplicates(bool ignoreVariations, int?
using var session = DatabaseFactory.SessionFactory.OpenSession();
if (animeID.HasValue && animeID.Value > 0)
{
var animeQuery = ignoreVariations ? IgnoreVariationsWithAnimeQuery : CountVariationsAithAnimeQuery;
var animeQuery = ignoreVariations ? IgnoreVariationsWithAnimeQuery : CountVariationsWithAnimeQuery;
return session.CreateSQLQuery(animeQuery)
.AddScalar("EpisodeID", NHibernateUtil.Int32)
.SetParameter("animeID", animeID.Value)
Expand Down

0 comments on commit aa983e4

Please sign in to comment.