Merge pull request #55 from JackDandy/feature/FixComingEpsIncludeShows

Fix Coming Eps Page to include shows +/- 1 day for time zone corrections.
This commit is contained in:
JackDandy 2014-11-24 01:12:35 +00:00
commit d9e3eacdda
3 changed files with 10 additions and 5 deletions

View file

@ -1,4 +1,4 @@
### 0.4.0 (2014-11-23 08:44:00 UTC)
### 0.4.0 (2014-11-24 00:55:00 UTC)
* Change footer stats to not add newlines when copy/pasting from them
* Remove redundant references from Config/Help & Info
@ -48,6 +48,7 @@
* Fix Add Trending Shows "Not In library" now filters tvrage added shows
* Add a hover over text "In library" on Add Trending Shows to display tv database show was added from
* Fix reduces time API endpoint Shows takes to return results
* Fix Coming Eps Page to include shows +/- 1 day for time zone corrections
### 0.3.1 (2014-11-19 16:40:00 UTC)

View file

@ -375,6 +375,7 @@
#set $today_header = True
#end if
#if $runtime:
#set $cur_ep_enddate = $cur_result['localtime'] + datetime.timedelta(minutes = $runtime)
#if $cur_ep_enddate < $today:
#set $show_div = 'ep_listing listing-overdue'
#elif $cur_ep_airdate >= $next_week.date():

View file

@ -351,11 +351,12 @@ class MainHandler(RequestHandler):
def comingEpisodes(self, layout="None"):
today1 = datetime.date.today()
today1 = datetime.date.today() - datetime.timedelta(days=1)
today = today1.toordinal()
tommorrow = (datetime.date.today() + datetime.timedelta(days=1))
next_week1 = (datetime.date.today() + datetime.timedelta(days=7))
next_week = next_week1.toordinal()
recently = (datetime.date.today() - datetime.timedelta(days=sickbeard.COMING_EPS_MISSED_RANGE)).toordinal()
next_week = (next_week1 + datetime.timedelta(days=1)).toordinal()
recently = (today1 - datetime.timedelta(days=sickbeard.COMING_EPS_MISSED_RANGE)).toordinal()
done_show_list = []
qualList = Quality.DOWNLOADED + Quality.SNATCHED + [ARCHIVED, IGNORED]
@ -378,9 +379,11 @@ class MainHandler(RequestHandler):
more_sql_results = myDB.select(
"SELECT *, tv_shows.status as show_status FROM tv_episodes, tv_shows WHERE season != 0 AND tv_shows.indexer_id = tv_episodes.showid AND airdate < ? AND airdate >= ? AND tv_episodes.status = ? AND tv_episodes.status NOT IN (" + ','.join(
['?'] * len(qualList)) + ")", [today, recently, WANTED] + qualList)
['?'] * len(qualList)) + ")", [tommorrow, recently, WANTED] + qualList)
sql_results += more_sql_results
sql_results = list(set(sql_results))
# sort by localtime
sorts = {
'date': (lambda x, y: cmp(x["localtime"], y["localtime"])),