From fddd566dfd66891d161493fb936f0064de4d53e6 Mon Sep 17 00:00:00 2001 From: Debian Guru Date: Sun, 27 May 2018 09:54:56 +0200 Subject: [PATCH] performance --- kontomodel.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kontomodel.py b/kontomodel.py index e6882ea..d5c8eb0 100644 --- a/kontomodel.py +++ b/kontomodel.py @@ -215,7 +215,15 @@ def getConsolidated(byCategory, traceNames, fromDate, toDate, categories, thepat def updateCategory(itemId, thecategory, thepath='lists/'): thefilenames = getLists(thepath) + fileIdPos = itemId.rfind('_') + if fileIdPos == -1: + raise Exception('invalid id') + fileId = itemId[0:fileIdPos] + for thefilename in thefilenames: + if not thefilename.startswith(fileId): + continue + content = parseFile(thefilename, thepath=thepath) for c in content: if c['id'] == itemId: