hopefully fix for status' not changing properly after Refresh as well as continually downloading same issues marked as downloaded

This commit is contained in:
evilhero 2012-10-21 11:30:26 -04:00
parent 85667e2590
commit 86c46134bd
3 changed files with 38 additions and 14 deletions

View File

@ -282,10 +282,10 @@ def addComictoDB(comicid,mismatch=None):
#---END.NEW.
# check if the issue already exists
iss_exists = myDB.select('SELECT * from issues WHERE IssueID=?', [issid])
iss_exists = myDB.action('SELECT * from issues WHERE IssueID=?', [issid]).fetchone()
# Only change the status & add DateAdded if the issue is not already in the database
if not len(iss_exists):
# Only change the status & add DateAdded if the issue is already in the database
if iss_exists is None:
newValueDict['DateAdded'] = helpers.today()
controlValueDict = {"IssueID": issid}
@ -303,6 +303,10 @@ def addComictoDB(comicid,mismatch=None):
else:
newValueDict['Status'] = "Skipped"
if iss_exists:
#print ("Existing status : " + str(iss_exists['Status']))
newValueDict['Status'] = iss_exists['Status']
myDB.upsert("issues", newValueDict, controlValueDict)
n+=1
@ -567,6 +571,11 @@ def GCDimport(gcomicid):
else:
newValueDict['Status'] = "Skipped"
if iss_exists:
#print ("Existing status : " + str(iss_exists['Status']))
newValueDict['Status'] = iss_exists['Status']
myDB.upsert("issues", newValueDict, controlValueDict)
bb+=1

View File

@ -49,23 +49,33 @@ def latest_update(ComicID, LatestIssue, LatestDate):
def upcoming_update(ComicID, ComicName, IssueNumber, IssueDate):
# here we add to upcoming table...
myDB = db.DBConnection()
controlValue = {"ComicID": ComicID}
newValue = {"ComicName": str(ComicName),
"IssueNumber": str(IssueNumber),
"IssueDate": str(IssueDate)}
if mylar.AUTOWANT_UPCOMING:
newValue['Status'] = "Wanted"
else:
newValue['Status'] = "Skipped"
myDB.upsert("upcoming", newValue, controlValue)
issuechk = myDB.action("SELECT * FROM issues WHERE ComicID=? AND Issue_Number=?", [ComicID, IssueNumber]).fetchone()
if issuechk is None:
pass
#print ("not released yet...")
if issuechk is None: pass
else:
#print ("checking..." + str(issuechk['ComicName']) + " Issue: " + str(issuechk['Issue_Number']))
#print ("existing status: " + str(issuechk['Status']))
control = {"IssueID": issuechk['IssueID']}
if mylar.AUTOWANT_UPCOMING: values = {"Status": "Wanted"}
else: values = {"Status": "Skipped"}
if mylar.AUTOWANT_UPCOMING:
newValue['Status'] = "Wanted"
values = { "Status": "Wanted"}
if issuechk['Status'] == "Snatched":
values = { "Status": "Snatched"}
newValue['Status'] = "Snatched"
elif issuechk['Status'] == "Downloaded":
values = { "Status": "Downloaded"}
newValue['Status'] = "Downloaded"
else:
values = { "Status": "Skipped"}
newValue['Status'] = "Skipped"
myDB.upsert("upcoming", newValue, controlValue)
myDB.upsert("issues", values, control)
@ -199,6 +209,8 @@ def forceRescan(ComicID):
else:
if old_status == "Wanted":
issStatus = "Wanted"
elif old_status == "Downloaded":
issStatus = "Downloaded"
else:
issStatus = "Skipped"
elif haveissue == "yes":

View File

@ -348,9 +348,12 @@ class WebInterface(object):
mvcontroldict = {"IssueID": myissue['IssueID']}
mvvalues = {"ComicID": myissue['ComicID'],
"Status": "Wanted"}
myDB.upsert("issues", mvvalues, mvcontroldict)
#remove old entry from upcoming so it won't try to continually download again.
deleteit = myDB.action("DELETE from upcoming WHERE ComicName=? AND IssueNumber=?", [mvup['ComicName'],mvup['IssueNumber']])
return serve_template(templatename="upcoming.html", title="Upcoming", upcoming=upcoming, issues=issues)
upcoming.exposed = True