From f92fbd03691ce0c3d3d4987478691c1c0ba4c440 Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Tue, 3 Sep 2024 10:35:32 +0200 Subject: [PATCH] bugfix related to generic dvms --- nostr_dvm/dvm.py | 2 +- setup.py | 2 +- tests/generic_dvm_autotopic_feed.py | 24 ++++++++++++------------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/nostr_dvm/dvm.py b/nostr_dvm/dvm.py index 4d361f0..e33479e 100644 --- a/nostr_dvm/dvm.py +++ b/nostr_dvm/dvm.py @@ -204,7 +204,7 @@ async def handle_nip90_job_event(nip90_event): self.dvm_config) for dvm in self.dvm_config.SUPPORTED_DVMS: - if dvm.TASK == task or dvm.TASK == "generic" and dvm.FIX_COST == 0 and dvm.PER_UNIT_COST == 0 and dvm_config.NIP88 is None: + if (dvm.TASK == task or dvm.TASK == "generic") and dvm.FIX_COST == 0 and dvm.PER_UNIT_COST == 0 and dvm_config.NIP88 is None: task_is_free = True cashu_redeemed = False diff --git a/setup.py b/setup.py index 5a3e757..722f866 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ from setuptools import setup, find_packages -VERSION = '0.8.14' +VERSION = '0.8.15' DESCRIPTION = 'A framework to build and run Nostr NIP90 Data Vending Machines' LONG_DESCRIPTION = ('A framework to build and run Nostr NIP90 Data Vending Machines. See the github repository for more information') diff --git a/tests/generic_dvm_autotopic_feed.py b/tests/generic_dvm_autotopic_feed.py index 8ab6ddf..0bc58f6 100644 --- a/tests/generic_dvm_autotopic_feed.py +++ b/tests/generic_dvm_autotopic_feed.py @@ -45,7 +45,7 @@ def playground(announce=False): dvm_config = build_default_config(identifier) dvm_config.KIND = Kind(kind) # Manually set the Kind Number (see data-vending-machines.org) dvm_config.CUSTOM_PROCESSING_MESSAGE = "Creating a personalized feed based on the topics you write about. This might take a moment." - + dvm_config.FIX_COST = 10 # Add NIP89 nip89info = { @@ -64,7 +64,7 @@ def playground(announce=False): nip89config.CONTENT = json.dumps(nip89info) options = { - "input": "How do you call a noisy ostrich?", + "input": "", } dvm = GenericDVM(name=name, dvm_config=dvm_config, nip89config=nip89config, @@ -138,16 +138,16 @@ async def process(request_form): ns.finallist = {} for event in events: - if all(ele in event.content().lower() for ele in []): - if any(ele in event.content().lower() for ele in result): - if not any(ele in event.content().lower() for ele in []): - filt = Filter().kinds( - [definitions.EventDefinitions.KIND_ZAP, definitions.EventDefinitions.KIND_REACTION, - definitions.EventDefinitions.KIND_REPOST, - definitions.EventDefinitions.KIND_NOTE]).event(event.id()).since(since) - reactions = await database.query([filt]) - if len(reactions) >= 1: - ns.finallist[event.id().to_hex()] = len(reactions) + #if all(ele in event.content().lower() for ele in []): + if any(ele in event.content().lower() for ele in result): + #if not any(ele in event.content().lower() for ele in []): + filt = Filter().kinds( + [definitions.EventDefinitions.KIND_ZAP, definitions.EventDefinitions.KIND_REACTION, + definitions.EventDefinitions.KIND_REPOST, + definitions.EventDefinitions.KIND_NOTE]).event(event.id()).since(since) + reactions = await database.query([filt]) + if len(reactions) >= 1: + ns.finallist[event.id().to_hex()] = len(reactions) result_list = [] finallist_sorted = sorted(ns.finallist.items(), key=lambda x: x[1], reverse=True)[:int(200)]