1
0
Fork 0
mirror of https://github.com/evilhero/mylar synced 2025-03-09 13:24:53 +00:00

FIX:(#912) Updated fix to include issues that have trailing decimal places - whether on purpose or not, which was causing incomplete loading of these series

This commit is contained in:
evilhero 2015-01-02 01:56:01 -05:00
parent 054b7cf3aa
commit 77899c2390
2 changed files with 36 additions and 7 deletions

View file

@ -573,7 +573,16 @@ def ComicSort(comicorder=None,sequence=None,imported=None):
if sequence: if sequence:
# if it's on startup, load the sql into a tuple for use to avoid record-locking # if it's on startup, load the sql into a tuple for use to avoid record-locking
i = 0 i = 0
import db, logger import logger
#if mylar.DBCHOICE == 'postgresql':
# import db_postgresql as db
# myDB = db.DBConnection()
# comicsort = myDB.select("SELECT * FROM comics ORDER BY ComicSortName COLLATE ?", [mylar.OS_LANG])
#else:
# import db
# myDB = db.DBConnection()
# comicsort = myDB.select("SELECT * FROM comics ORDER BY ComicSortName COLLATE NOCASE")
import db
myDB = db.DBConnection() myDB = db.DBConnection()
comicsort = myDB.select("SELECT * FROM comics ORDER BY ComicSortName COLLATE NOCASE") comicsort = myDB.select("SELECT * FROM comics ORDER BY ComicSortName COLLATE NOCASE")
comicorderlist = [] comicorderlist = []
@ -828,9 +837,15 @@ def issuedigits(issnum):
if len(decis) == 1: if len(decis) == 1:
decisval = int(decis) * 10 decisval = int(decis) * 10
issaftdec = str(decisval) issaftdec = str(decisval)
if len(decis) >= 2: elif len(decis) == 2:
decisval = int(decis) decisval = int(decis)
issaftdec = str(decisval) issaftdec = str(decisval)
else:
decisval = decis
issaftdec = str(decisval)
#if there's a trailing decimal (ie. 1.50.) and it's either intentional or not, blow it away.
if issaftdec[-1:] == '.':
issaftdec = issaftdec[:-1]
try: try:
int_issnum = (int(issb4dec) * 1000) + (int(issaftdec) * 10) int_issnum = (int(issb4dec) * 1000) + (int(issaftdec) * 10)
except ValueError: except ValueError:
@ -1060,12 +1075,22 @@ def havetotals(refreshit=None):
comics = [] comics = []
myDB = db.DBConnection()
if refreshit is None: if refreshit is None:
#if mylar.DBCHOICE == 'postgresql':
# import db_postgresql as db
# myDB = db.DBConnection()
# comiclist = myDB.select("SELECT * from comics order by ComicSortName COLLATE ?",[mylar.OS_LANG])
#else:
# import db
# myDB = db.DBConnection()
# comiclist = myDB.select('SELECT * from comics order by ComicSortName COLLATE NOCASE')
import db
myDB = db.DBConnection()
comiclist = myDB.select('SELECT * from comics order by ComicSortName COLLATE NOCASE') comiclist = myDB.select('SELECT * from comics order by ComicSortName COLLATE NOCASE')
else: else:
comiclist = [] comiclist = []
myDB = db.DBConnection()
comicref = myDB.selectone("SELECT * from comics WHERE ComicID=?", [refreshit]).fetchone() comicref = myDB.selectone("SELECT * from comics WHERE ComicID=?", [refreshit]).fetchone()
#refreshit is the ComicID passed from the Refresh Series to force/check numerical have totals #refreshit is the ComicID passed from the Refresh Series to force/check numerical have totals
comiclist.append({"ComicID": comicref[0], comiclist.append({"ComicID": comicref[0],
@ -1471,7 +1496,7 @@ def int_num(s):
return int(s) return int(s)
except ValueError: except ValueError:
return float(s) return float(s)
def listLibrary(): def listLibrary():
import db import db
library = {} library = {}

View file

@ -524,7 +524,6 @@ def addComictoDB(comicid,mismatch=None,pullupd=None,imported=None,ogcname=None,c
latestiss = issuedata['LatestIssue'] latestiss = issuedata['LatestIssue']
latestdate = issuedata['LatestDate'] latestdate = issuedata['LatestDate']
lastpubdate = issuedata['LastPubDate'] lastpubdate = issuedata['LastPubDate']
#move the files...if imported is not empty & not futurecheck (meaning it's not from the mass importer.) #move the files...if imported is not empty & not futurecheck (meaning it's not from the mass importer.)
if imported is None or imported == 'None' or imported == 'futurecheck': if imported is None or imported == 'None' or imported == 'futurecheck':
pass pass
@ -1120,7 +1119,7 @@ def updateissuedata(comicid, comicname=None, issued=None, comicIssues=None, call
cleanname = 'None' cleanname = 'None'
issid = str(firstval['Issue_ID']) issid = str(firstval['Issue_ID'])
issnum = firstval['Issue_Number'] issnum = firstval['Issue_Number']
#print ("issnum: " + str(issnum)) #logger.info("issnum: " + str(issnum))
issname = cleanname issname = cleanname
issdate = str(firstval['Issue_Date']) issdate = str(firstval['Issue_Date'])
storedate = str(firstval['Store_Date']) storedate = str(firstval['Store_Date'])
@ -1167,6 +1166,10 @@ def updateissuedata(comicid, comicname=None, issued=None, comicIssues=None, call
else: else:
decisval = decis decisval = decis
issaftdec = str(decisval) issaftdec = str(decisval)
#if there's a trailing decimal (ie. 1.50.) and it's either intentional or not, blow it away.
if issaftdec[-1:] == '.':
logger.fdebug('Trailing decimal located within issue number. Irrelevant to numbering. Obliterating.')
issaftdec = issaftdec[:-1]
try: try:
# int_issnum = str(issnum) # int_issnum = str(issnum)
int_issnum = (int(issb4dec) * 1000) + (int(issaftdec) * 10) int_issnum = (int(issb4dec) * 1000) + (int(issaftdec) * 10)
@ -1201,12 +1204,13 @@ def updateissuedata(comicid, comicname=None, issued=None, comicIssues=None, call
if len(issnum) == 1 and issnum.isalpha(): if len(issnum) == 1 and issnum.isalpha():
logger.fdebug('detected lone alpha issue. Attempting to figure this out.') logger.fdebug('detected lone alpha issue. Attempting to figure this out.')
break break
logger.fdebug('[' + issno + '] Invalid numeric for issue - cannot be found. Ignoring.') logger.fdebug('[' + issno + '] invalid numeric for issue - cannot be found. Ignoring.')
issno = None issno = None
tstord = None tstord = None
invchk = "true" invchk = "true"
break break
x+=1 x+=1
if tstord is not None and issno is not None: if tstord is not None and issno is not None:
a = 0 a = 0
ordtot = 0 ordtot = 0