<%inherit file="base.html"/> <%! from mylar import helpers, db import datetime %> <%def name="body()">
%for comic in comics: <% myDB = db.DBConnection() issue = myDB.select("SELECT * FROM issues WHERE ComicID=?", [comic['ComicID']]) wantedc = myDB.action("SELECT COUNT(*) as count FROM issues WHERE ComicID=? AND Status='Wanted'", [comic['ComicID']]).fetchone() anwantedc = myDB.action("SELECT COUNT(*) as count FROM annuals WHERE ComicID=? AND Status='Wanted'", [comic['ComicID']]).fetchone() annual = myDB.action("SELECT COUNT(*) as count FROM annuals WHERE ComicID=?", [comic['ComicID']]).fetchone() archedc = myDB.action("SELECT COUNT(*) as count FROM issues WHERE ComicID=? AND Status='Archived'", [comic['ComicID']]).fetchone() annualcount = annual[0] if not annualcount: annualcount = 0 totaltracks = comic['Total'] + annualcount havetracks = comic['Have'] wants = wantedc[0] anns = anwantedc[0] arcs = archedc[0] if not havetracks: havetracks = 0 if not wants: wants = 0 if not anns: anns = 0 if not arcs: arcs = 0 try: wantpercent = (wants*100.0)/totaltracks if wantpercent > 100: wantpercent = 100 except (ZeroDivisionError, TypeError): wantpercent = 0 wants = '?' try: percent = (havetracks*100.0)/totaltracks if percent > 100: percent = 100 except (ZeroDivisionError, TypeError): percent = 0 totaltracks = '?' if comic['Status'] == 'Paused': grade = 'X' elif comic['Status'] == 'Loading': grade = 'L' elif comic['Status'] == 'Error': grade = 'X' else: grade = 'A' %> %endfor
Publisher Comic Year Last Issue Published Have Status Active
${comic['ComicPublisher']} ${comic['ComicName']} ${comic['ComicYear']} # ${comic['LatestIssue']} ${comic['LatestDate']}
${havetracks}/${totaltracks}
%if comic['ComicPublished'] is None or comic['ComicPublished'] == '': Unknown %elif comic['ForceContinuing'] == 1: Continuing %elif 'present' in comic['ComicPublished'].lower() or ( helpers.today()[:4] in comic['LatestDate']): <% latestdate = comic['LatestDate'] c_date = datetime.date(int(latestdate[:4]),int(latestdate[5:7]),1) n_date = datetime.date.today() recentchk = (n_date - c_date).days if recentchk < 55: recentstatus = 'Continuing' else: recentstatus = 'Ended' %> ${recentstatus} %else: Ended %endif %if comic['Status'] == "Active": Y %else: N %endif
<%def name="headIncludes()"> <%def name="javascriptIncludes()">