From 309e1ba249f6f6f073696ef14e336a5f3ad432b1 Mon Sep 17 00:00:00 2001 From: markus101 Date: Wed, 16 Feb 2011 00:16:14 -0800 Subject: [PATCH] Fixed issue with storing and retrieving quality profile, checking the profile. --- NzbDrone.Core/Providers/SeriesProvider.cs | 4 ++-- NzbDrone.Core/Repository/Quality/QualityProfile.cs | 5 ++++- NzbDrone.Core/Repository/Series.cs | 5 ++++- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/NzbDrone.Core/Providers/SeriesProvider.cs b/NzbDrone.Core/Providers/SeriesProvider.cs index b2ffe0c0d..16fbc44f5 100644 --- a/NzbDrone.Core/Providers/SeriesProvider.cs +++ b/NzbDrone.Core/Providers/SeriesProvider.cs @@ -58,7 +58,7 @@ public bool IsMonitored(long id) public bool QualityWanted(int seriesId, QualityTypes quality) { var series = _sonioRepo.Single(seriesId); - var profile = _quality.Find(series.QualityProfile.ProfileId); + var profile = _quality.Find(series.ProfileId); return profile.Allowed.Contains(quality); } @@ -108,7 +108,7 @@ public void AddSeries(string path, TvdbSeries series) repoSeries.Path = path; repoSeries.CleanTitle = Parser.NormalizeTitle(series.SeriesName); repoSeries.Monitored = true; //New shows should be monitored - repoSeries.QualityProfile = _quality.Find(Convert.ToInt32(_config.GetValue("Quality", 1, true))); + repoSeries.ProfileId = Convert.ToInt32(_config.GetValue("Quality", 1, true)); _sonioRepo.Add(repoSeries); } diff --git a/NzbDrone.Core/Repository/Quality/QualityProfile.cs b/NzbDrone.Core/Repository/Quality/QualityProfile.cs index 280604ab3..a06677700 100644 --- a/NzbDrone.Core/Repository/Quality/QualityProfile.cs +++ b/NzbDrone.Core/Repository/Quality/QualityProfile.cs @@ -11,7 +11,7 @@ public class QualityProfile [SubSonicPrimaryKey(true)] public int ProfileId { get; set; } - [Required (ErrorMessage = "A Name is Required")] + [Required(ErrorMessage = "A Name is Required")] [DisplayName("Name")] [DisplayFormat(ConvertEmptyStringToNull = false)] public string Name { get; set; } @@ -52,5 +52,8 @@ private set } } } + + [SubSonicToManyRelation] + public virtual List Series { get; private set; } } } diff --git a/NzbDrone.Core/Repository/Series.cs b/NzbDrone.Core/Repository/Series.cs index b43e017bf..119b7c548 100644 --- a/NzbDrone.Core/Repository/Series.cs +++ b/NzbDrone.Core/Repository/Series.cs @@ -30,7 +30,10 @@ public class Series public bool Monitored { get; set; } - public QualityProfile QualityProfile { get; set; } + public virtual int ProfileId { get; set; } + + [SubSonicToOneRelation(ThisClassContainsJoinKey = true)] + public virtual QualityProfile QualityProfile { get; set; } [SubSonicToManyRelation] public virtual List Seasons { get; private set; }