From a7e0a5fa8e24865e83428087132874aeecbcd36b Mon Sep 17 00:00:00 2001 From: Edward Betts Date: Fri, 14 May 2021 17:01:46 +0200 Subject: [PATCH] Get item from database, or download if missing --- web_view.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/web_view.py b/web_view.py index 1c84f22..bf0fa65 100755 --- a/web_view.py +++ b/web_view.py @@ -676,6 +676,16 @@ skip_isa = { } skip_tags = {"Key:addr:street"} +def get_item(item_id): + item = model.Item.query.get(item_id) + if item: + return item + item = get_and_save_item(f"Q{item_id}") + database.session.add(item) + database.session.commit() + return item + + def get_items(item_ids): items = [] for item_id in item_ids: