1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2024-12-12 11:15:43 +02:00

Fixed issue with storing and retrieving quality profile, checking the profile.

This commit is contained in:
markus101 2011-02-16 00:16:14 -08:00
parent a7780fab67
commit 309e1ba249
3 changed files with 10 additions and 4 deletions

View File

@ -58,7 +58,7 @@ public bool IsMonitored(long id)
public bool QualityWanted(int seriesId, QualityTypes quality)
{
var series = _sonioRepo.Single<Series>(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);
}

View File

@ -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<string> Series { get; private set; }
}
}

View File

@ -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<Season> Seasons { get; private set; }