mirror of
https://github.com/evilhero/mylar
synced 2024-12-24 08:42:37 +00:00
FIX: Fix for empty pullist table for first week of 2017
This commit is contained in:
parent
7278198bee
commit
ce9e926771
5 changed files with 29 additions and 15 deletions
|
@ -21,7 +21,7 @@
|
|||
</br></br>
|
||||
<table width="100%" align="center">
|
||||
<tr>
|
||||
<td style="vertical-align: middle; text-align: right"><a href="pullist?week=${weekinfo['prev_weeknumber']}&year=${weekinfo['year']}" title="Previous Week (${weekinfo['prev_weeknumber']})"><img src="interfaces/default/images/prev.gif" width="16" height="18" Alt="Previous"/></td>
|
||||
<td style="vertical-align: middle; text-align: right"><a href="pullist?week=${weekinfo['prev_weeknumber']}&year=${weekinfo['prev_year']}" title="Previous Week (${weekinfo['prev_weeknumber']})"><img src="interfaces/default/images/prev.gif" width="16" height="18" Alt="Previous"/></td>
|
||||
<td style="vertical-align: middle; text-align: center">
|
||||
%if wantedcount == 0:
|
||||
<h1><center>Weekly Pull list for week ${weekinfo['weeknumber']} :</br>${weekinfo['startweek']} - ${weekinfo['endweek']}</center></h1>
|
||||
|
@ -29,7 +29,7 @@
|
|||
<h1><center>Weekly Pull list for week ${weekinfo['weeknumber']} :</br>${weekinfo['startweek']} - ${weekinfo['endweek']} (${wantedcount})</center></h1>
|
||||
%endif
|
||||
</td><td style="vertical-align: middle; text-align: left">
|
||||
<a href="pullist?week=${weekinfo['next_weeknumber']}&year=${weekinfo['year']}" title="Next Week (${weekinfo['next_weeknumber']})"><img src="interfaces/default/images/next.gif" width="16" height="18" Alt="Next"/></a></td>
|
||||
<a href="pullist?week=${weekinfo['next_weeknumber']}&year=${weekinfo['next_year']}" title="Next Week (${weekinfo['next_weeknumber']})"><img src="interfaces/default/images/next.gif" width="16" height="18" Alt="Next"/></a></td>
|
||||
<tr>
|
||||
</table>
|
||||
</div>
|
||||
|
@ -117,6 +117,7 @@
|
|||
%endfor
|
||||
</tbody>
|
||||
</table>
|
||||
</br><small><center>last updated: ${weekinfo['last_update']}</center></small>
|
||||
</div>
|
||||
</%def>
|
||||
|
||||
|
|
|
@ -1767,7 +1767,7 @@ def listIssues(weeknumber, year):
|
|||
library = []
|
||||
myDB = db.DBConnection()
|
||||
# Get individual issues
|
||||
list = myDB.select("SELECT issues.Status, issues.ComicID, issues.IssueID, issues.ComicName, weekly.publisher, issues.Issue_Number from weekly, issues where weekly.IssueID = issues.IssueID and weeknumber = ? and year = ?", [weeknumber, year])
|
||||
list = myDB.select("SELECT issues.Status, issues.ComicID, issues.IssueID, issues.ComicName, weekly.publisher, issues.Issue_Number from weekly, issues where weekly.IssueID = issues.IssueID and weeknumber = ? and year = ?", [int(weeknumber), year])
|
||||
for row in list:
|
||||
library.append({'ComicID': row['ComicID'],
|
||||
'Status': row['Status'],
|
||||
|
@ -1777,7 +1777,7 @@ def listIssues(weeknumber, year):
|
|||
'Issue_Number': row['Issue_Number']})
|
||||
# Add the annuals
|
||||
if mylar.ANNUALS_ON:
|
||||
list = myDB.select("SELECT annuals.Status, annuals.ComicID, annuals.ReleaseComicID, annuals.IssueID, annuals.ComicName, weekly.publisher, annuals.Issue_Number from weekly, annuals where weekly.IssueID = annuals.IssueID and weeknumber = ? and year = ?", [weeknumber, year])
|
||||
list = myDB.select("SELECT annuals.Status, annuals.ComicID, annuals.ReleaseComicID, annuals.IssueID, annuals.ComicName, weekly.publisher, annuals.Issue_Number from weekly, annuals where weekly.IssueID = annuals.IssueID and weeknumber = ? and year = ?", [int(weeknumber), year])
|
||||
for row in list:
|
||||
library.append({'ComicID': row['ComicID'],
|
||||
'Status': row['Status'],
|
||||
|
|
|
@ -22,7 +22,7 @@ from mylar import logger, db
|
|||
|
||||
def locg(pulldate=None,weeknumber=None,year=None):
|
||||
|
||||
todaydate = datetime.datetime.today()
|
||||
todaydate = datetime.datetime.today().replace(second=0,microsecond=0)
|
||||
if pulldate:
|
||||
logger.info('pulldate is : ' + str(pulldate))
|
||||
if pulldate is None or pulldate == '00000000':
|
||||
|
|
|
@ -1579,8 +1579,17 @@ class WebInterface(object):
|
|||
year = todaydate.strftime("%Y")
|
||||
|
||||
prev_week = int(weeknumber) - 1
|
||||
next_week = int(weeknumber) + 1
|
||||
prev_year = year
|
||||
if prev_week == 0:
|
||||
prev_week = 52
|
||||
prev_year = int(year) - 1
|
||||
|
||||
next_week = int(weeknumber) + 1
|
||||
next_year = year
|
||||
if next_week == 53:
|
||||
next_week = 1
|
||||
next_year = int(year) + 1
|
||||
|
||||
date_fmt = "%B %d, %Y"
|
||||
|
||||
weekinfo = {'weeknumber': weeknumber,
|
||||
|
@ -1589,8 +1598,11 @@ class WebInterface(object):
|
|||
'endweek': u"" + endweek.strftime(date_fmt).decode('utf-8'),
|
||||
'year': year,
|
||||
'prev_weeknumber': prev_week,
|
||||
'prev_year': prev_year,
|
||||
'next_weeknumber': next_week,
|
||||
'current_weeknumber': current_weeknumber}
|
||||
'next_year': next_year,
|
||||
'current_weeknumber': current_weeknumber,
|
||||
'last_update': mylar.PULL_REFRESH}
|
||||
|
||||
if mylar.WEEKFOLDER_LOC is not None:
|
||||
weekdst = mylar.WEEKFOLDER_LOC
|
||||
|
@ -1604,19 +1616,19 @@ class WebInterface(object):
|
|||
|
||||
popit = myDB.select("SELECT * FROM sqlite_master WHERE name='weekly' and type='table'")
|
||||
if popit:
|
||||
w_results = myDB.select("SELECT * from weekly WHERE weeknumber=?", [str(weeknumber)])
|
||||
w_results = myDB.select("SELECT * from weekly WHERE weeknumber=? AND year=?", [int(weeknumber),year])
|
||||
if len(w_results) == 0:
|
||||
logger.info('trying to repopulate to week: ' + str(weeknumber) + '-' + str(year))
|
||||
repoll = self.manualpull(weeknumber=weeknumber,year=year)
|
||||
if repoll['status'] == 'success':
|
||||
w_results = myDB.select("SELECT * from weekly WHERE weeknumber=?", [str(weeknumber)])
|
||||
w_results = myDB.select("SELECT * from weekly WHERE weeknumber=? AND year=?", [int(weeknumber),year])
|
||||
else:
|
||||
logger.warn('Problem repopulating the pullist for week ' + str(weeknumber) + ', ' + str(year))
|
||||
if mylar.ALT_PULL == 2:
|
||||
logger.warn('Attempting to repoll against legacy pullist in order to have some kind of updated listing for the week.')
|
||||
repoll = self.manualpull()
|
||||
if repoll['status'] == 'success':
|
||||
w_results = myDB.select("SELECT * from weekly WHERE weeknumber=?", [str(weeknumber)])
|
||||
w_results = myDB.select("SELECT * from weekly WHERE weeknumber=? AND year=?", [int(weeknumber),year])
|
||||
else:
|
||||
logger.warn('Unable to populate the pull-list. Not continuing at this time (will try again in abit)')
|
||||
|
||||
|
@ -1632,8 +1644,9 @@ class WebInterface(object):
|
|||
if weekly['ComicID'] in watchlibrary:
|
||||
haveit = watchlibrary[weekly['ComicID']]
|
||||
|
||||
if all([week >= weeknumber, mylar.AUTOWANT_UPCOMING, tmp_status == 'Skipped']):
|
||||
tmp_status = 'Wanted'
|
||||
if weeknumber:
|
||||
if any([week >= int(weeknumber), week is None]) and all([mylar.AUTOWANT_UPCOMING, tmp_status == 'Skipped']):
|
||||
tmp_status = 'Wanted'
|
||||
|
||||
for x in issueLibrary:
|
||||
if weekly['IssueID'] == x['IssueID']:
|
||||
|
|
|
@ -928,7 +928,7 @@ def new_pullcheck(weeknumber, pullyear, comic1off_name=None, comic1off_id=None,
|
|||
if not comic1off_id:
|
||||
logger.fdebug("[WALKSOFTLY] You are watching for: " + str(len(weeklylist)) + " comics")
|
||||
|
||||
weekly = myDB.select('SELECT a.comicid, IFNULL(a.Comic,IFNULL(b.ComicName, c.ComicName)) as ComicName, a.rowid, a.issue, a.issueid, c.ComicPublisher, a.weeknumber, a.shipdate, a.dynamicname FROM weekly as a INNER JOIN annuals as b INNER JOIN comics as c ON b.releasecomicid = a.comicid OR c.comicid = a.comicid OR c.DynamicComicName = a.dynamicname WHERE weeknumber = ? GROUP BY a.dynamicname', [weeknumber]) #comics INNER JOIN weekly ON comics.DynamicComicName = weekly.dynamicname OR comics.comicid = weekly.comicid INNER JOIN annuals ON annuals.comicid = weekly.comicid WHERE weeknumber = ? GROUP BY weekly.dynamicname', [weeknumber])
|
||||
weekly = myDB.select('SELECT a.comicid, IFNULL(a.Comic,IFNULL(b.ComicName, c.ComicName)) as ComicName, a.rowid, a.issue, a.issueid, c.ComicPublisher, a.weeknumber, a.shipdate, a.dynamicname FROM weekly as a INNER JOIN annuals as b INNER JOIN comics as c ON b.releasecomicid = a.comicid OR c.comicid = a.comicid OR c.DynamicComicName = a.dynamicname WHERE weeknumber = ? AND year = ? GROUP BY a.dynamicname', [int(weeknumber),pullyear]) #comics INNER JOIN weekly ON comics.DynamicComicName = weekly.dynamicname OR comics.comicid = weekly.comicid INNER JOIN annuals ON annuals.comicid = weekly.comicid WHERE weeknumber = ? GROUP BY weekly.dynamicname', [weeknumber])
|
||||
for week in weekly:
|
||||
idmatch = None
|
||||
annualidmatch = None
|
||||
|
@ -1070,7 +1070,7 @@ def new_pullcheck(weeknumber, pullyear, comic1off_name=None, comic1off_id=None,
|
|||
|
||||
newValue['COMIC'] = comicname
|
||||
newValue['ISSUE'] = week['issue']
|
||||
newValue['WEEKNUMBER'] = weeknumber
|
||||
newValue['WEEKNUMBER'] = int(weeknumber)
|
||||
newValue['YEAR'] = pullyear
|
||||
|
||||
if issueid:
|
||||
|
@ -1080,7 +1080,7 @@ def new_pullcheck(weeknumber, pullyear, comic1off_name=None, comic1off_id=None,
|
|||
newValue = {"ComicID": comicid,
|
||||
"COMIC": week['ComicName'],
|
||||
"ISSUE": week['issue'],
|
||||
"WEEKNUMBER": weeknumber,
|
||||
"WEEKNUMBER": int(weeknumber),
|
||||
"YEAR": pullyear}
|
||||
|
||||
logger.info('controlValue:' + str(controlValue))
|
||||
|
|
Loading…
Reference in a new issue