Commit 5761806f authored by echel0n's avatar echel0n
Browse files

Fixed "Multiple rows were found for one_or_none()" exception when getting json...

Fixed "Multiple rows were found for one_or_none()" exception when getting json object of episode object
parent 811535ab
......@@ -1379,9 +1379,12 @@ class TVEpisode(object):
def to_json(self):
with sickrage.app.main_db.session() as session:
episode = session.query(MainDB.TVEpisode).filter_by(series_id=self.series_id, episode_id=self.episode_id).one_or_none()
json_data = TVEpisodeSchema().dump(episode)
episode = session.query(MainDB.TVEpisode).filter_by(series_provider_id=self.series_provider_id,
series_id=self.series_id,
season=self.season,
episode=self.episode).one_or_none()
json_data = TVEpisodeSchema().dump(episode)
json_data['seriesId'] = self.series_id
json_data['episodeSlug'] = self.slug
json_data['overview'] = self.overview.name
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment