summaryrefslogtreecommitdiffstats
path: root/parsers/logbooks.py
diff options
context:
space:
mode:
Diffstat (limited to 'parsers/logbooks.py')
-rw-r--r--parsers/logbooks.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/parsers/logbooks.py b/parsers/logbooks.py
index 838c253..86016af 100644
--- a/parsers/logbooks.py
+++ b/parsers/logbooks.py
@@ -480,6 +480,10 @@ def parser_blog(year, expedition, txt, sq=""):
entrytuple = (tripdate, location, tripname, tripcontent, trippeople, expedition, tu, tid)
logentries.append(entrytuple)
+def clean_all_logbooks():
+ DataIssue.objects.filter(parser="logbooks").delete()
+ LogbookEntry.objects.all().delete()
+
def clean_logbook_for_expedition(expedition):
def cleanerrors(year):
dataissues = DataIssue.objects.filter(parser="logbooks")
@@ -576,12 +580,12 @@ def parse_logbook_for_expedition(expedition):
def LoadLogbook(year):
"""One off logbook for testing purposes"""
global LOGBOOK_PARSER_SETTINGS
-
nlbe = {}
expo = Expedition.objects.get(year=year)
year = expo.year # some type funny
clean_logbook_for_expedition(expo)
+
nlbe[expo] = parse_logbook_for_expedition(expo) # this actually loads the logbook for one expo
if year in BLOG_PARSER_SETTINGS:
print("BLOG parsing")
@@ -600,7 +604,7 @@ def LoadLogbooks():
"""
global entries
- DataIssue.objects.filter(parser="logbooks").delete()
+ clean_all_logbooks()
expos = Expedition.objects.all()
if len(expos) <= 1:
message = " ! - No expeditions found. Load 'people' first"
@@ -648,7 +652,7 @@ def LoadLogbooks():
orig = (DEFAULT_LOGBOOK_FILE, DEFAULT_LOGBOOK_PARSER)
LOGBOOK_PARSER_SETTINGS[str(b)] = BLOG_PARSER_SETTINGS[str(b)]
print(f" - BLOG: {b}")
- nlbe[b] = parse_logbook_for_expedition(b, clean=False) # this loads the blog logbook for one expo
+ nlbe[b] = parse_logbook_for_expedition(b) # no clean. loads the blog logbook for one expo
LOGBOOK_PARSER_SETTINGS[str(b)] = orig
# tried to use map with concurrent threads - but sqlite database is not concurrent, so failed with database lock