From d9d4181dda0afbcc7c7d5da85853fc5a614dcd0c Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Sun, 29 Jan 2023 12:11:47 +0000 Subject: Add new survex import report --- core/utils.py | 2 ++ core/views/statistics.py | 28 +++++++++++++++++++++++++--- 2 files changed, 27 insertions(+), 3 deletions(-) (limited to 'core') diff --git a/core/utils.py b/core/utils.py index 0b18e3b..29c2643 100644 --- a/core/utils.py +++ b/core/utils.py @@ -205,6 +205,8 @@ def save_carefully(objectType, lookupAttribs={}, nonLookupAttribs={}): We are not using new_since_parsing - it is a fossil from Aaron Curtis's design in 2006. So it is always false. NOTE: this takes twice as long as simply creating a new object with the given values. + + As of Jan.2023 this function is not used anywhere in troggle. """ try: diff --git a/core/views/statistics.py b/core/views/statistics.py index 28bc721..65aca94 100644 --- a/core/views/statistics.py +++ b/core/views/statistics.py @@ -21,8 +21,12 @@ from troggle.parsers.people import (GetPersonExpeditionNameLookup, foreign_friends) #from django.views.generic.list import ListView +'''Very simple report pages summarizing data about the whole set of expeditions and of +the status of data inconsistencies +''' def therionissues(request): + """Page displaying contents of a file produced during data import""" logname = "therionrefs.log" logpath = (Path(settings.PYTHON_PATH, logname)) therionlog = [] @@ -40,11 +44,29 @@ def therionissues(request): newlog.append(line) return render(request, 'therionreport.html', {"therionlog":newlog}) -'''Very simple report pages summarizing data about the whole set of expeditions and of -the status of data inconsistencies -''' +def surveximport(request): + """Page displaying contents of a file produced during data import""" + logname = "svxlinear.log" + logpath = (Path(settings.PYTHON_PATH, logname)) + contents = [] + newlog = [] + + if Path(logpath).is_file: + with open(logpath, "r") as f: + contents = f.readlines() + print(f"{logpath} has {len(contents)} entries") + else: + print(f"{logpath} NOT FOUND {len(contents)}") + + for line in contents: + line = line.replace(" ", " ") + newlog.append(line) + return render(request, 'survexreport.html', {"log":newlog}) + def pathsreport(request): + """The CONSTANTs declared in the settings and localsettings and how they have + been evaluated for this specific installation - live """ pathsdict = OrderedDict() try: pathsdict = { -- cgit v1.2.3