checksum = m.hexdigest()
log.info('Updating influence in {}: {}'.format(system, influence))
+ update = False
for faction in factions:
state_id = eddb.get_state_id(faction['FactionState'])
if state_id is None:
cursor = self.query('insert or ignore into faction_influence values (?, ?, ?, ?, ?, ?)', [checksum, system_id, timestamp, faction_id, faction['Influence'], state_id])
if not cursor.rowcount:
log.debug('No update for {} with checksum {}'.format(system, checksum))
+ update = True
+ if update:
+ # We need a value for faction_id to use the index.
+ cursor = self.query('update faction_influence set timestamp=? where checksum=? and eddb_id=? and faction_id>0', [timestamp, checksum, system_id])
+ if not cursor.rowcount:
+ log.warning('Failed to update timestamp for {} with checksum {}'.format(system, checksum))
self.dbh.commit()
self.close_db()