Open rlhelinski opened 6 years ago
A list of all the releases that have ever been checked out can be compiled with:
c.cm.executeAndFetch('select distinct(release) from checkout_events')
A list of only releases that are currently checked out can be compiled with:
relIds = c.cm.executeAndFetch('select distinct(release) from checkout_events')
for relId in relIds:
if c.getCheckOutStatus(relId[0]):
print (relId[0], c.getReleaseArtist(relId[0]), c.getReleaseTitle(relId[0]), c.getCheckOutStatus(relId[0]))
sqlite> alter table releases add column checkedout REFERENCES checkout_events(ROWID);
Then, to populate this new column as appropriate:
results = c.cm.executeAndFetch('select distinct(release), rowid from checkout_events')
for relId, rowId in results:
if c.getCheckOutStatus(relId):
print (relId, rowId, c.getReleaseArtist(relId), c.getReleaseTitle(relId), c.getCheckOutStatus(relId))
c.cm.execute('update releases set checkedout = % where id = %', (rowId, relId))