1
0
Fork 0
mirror of https://github.com/evilhero/mylar synced 2024-12-25 01:01:47 +00:00

FIX: getUpcoming API method: Include 'Snatched' issues in addition to 'Downloaded' issues when &include_downloaded_issues=Y, FIX: getUpcoming API method: Align with the Weekly Pull List (use Sunday instead of Monday as the first day of the week)

This commit is contained in:
davalanche 2017-01-28 22:49:51 -06:00 committed by evilhero
parent c24e5db131
commit 38ba9337c2

View file

@ -174,18 +174,19 @@ class Api(object):
def _getUpcoming(self, **kwargs):
if 'include_downloaded_issues' in kwargs and kwargs['include_downloaded_issues'].upper() == 'Y':
select_status_clause = "w.STATUS IN ('Wanted', 'Downloaded')"
select_status_clause = "w.STATUS IN ('Wanted', 'Snatched', 'Downloaded')"
else:
select_status_clause = "w.STATUS = 'Wanted'"
# Days in a new year that precede the first Monday will look to the previous Monday for week and year.
# Days in a new year that precede the first Sunday will look to the previous Sunday for week and year.
today = datetime.date.today()
if today.strftime('%W') == '00':
monday = today - datetime.timedelta(days=today.weekday())
week = monday.strftime('%W')
year = monday.strftime('%Y')
if today.strftime('%U') == '00':
weekday = 0 if today.isoweekday() == 7 else today.isoweekday()
sunday = today - datetime.timedelta(days=weekday)
week = sunday.strftime('%U')
year = sunday.strftime('%Y')
else:
week = today.strftime('%W')
week = today.strftime('%U')
year = today.strftime('%Y')
self.data = self._dic_from_query(