From ff2d7d4de593f89e8f6ae12f58682970a4a0e04c Mon Sep 17 00:00:00 2001 From: Believethehype Date: Tue, 5 Mar 2024 16:29:21 +0100 Subject: [PATCH] Update content_discovery_currently_popular.py --- nostr_dvm/tasks/content_discovery_currently_popular.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/nostr_dvm/tasks/content_discovery_currently_popular.py b/nostr_dvm/tasks/content_discovery_currently_popular.py index 2065a7a..e445775 100644 --- a/nostr_dvm/tasks/content_discovery_currently_popular.py +++ b/nostr_dvm/tasks/content_discovery_currently_popular.py @@ -98,10 +98,11 @@ class DicoverContentCurrentlyPopular(DVMTaskInterface): events = cli.database().query([filter1]) ns.finallist = {} for event in events: - ns.finallist[event.id().to_hex()] = 0 - filt = Filter().kinds([9735, 7, 1]).event(event.id()).since(lasthour) - reactions = cli.database().query([filt]) - ns.finallist[event.id().to_hex()] = len(reactions) + if event.created_at().as_secs() > timestamp_hour_ago: + ns.finallist[event.id().to_hex()] = 0 + filt = Filter().kinds([9735, 7, 1]).event(event.id()).since(lasthour) + reactions = cli.database().query([filt]) + ns.finallist[event.id().to_hex()] = len(reactions) result_list = [] finallist_sorted = sorted(ns.finallist.items(), key=lambda x: x[1], reverse=True)[:int(options["max_results"])]