added IGNORE to insert into trend query

This commit is contained in:
Lex Berezhny 2019-06-28 16:02:54 -04:00
parent 8a5b803788
commit 82f2ad21e1

View file

@ -61,7 +61,7 @@ def calculate_trending(db, height, is_first_sync, final_height):
start = (height-TRENDING_WINDOW)+1 start = (height-TRENDING_WINDOW)+1
db.execute(f""" db.execute(f"""
INSERT INTO trend (claim_hash, height, amount) INSERT OR IGNORE INTO trend (claim_hash, height, amount)
SELECT claim_hash, {start}, COALESCE( SELECT claim_hash, {start}, COALESCE(
(SELECT SUM(amount) FROM support WHERE claim_hash=claim.claim_hash (SELECT SUM(amount) FROM support WHERE claim_hash=claim.claim_hash
AND height >= {start}), 0 AND height >= {start}), 0