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/views/statistics.py | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) (limited to 'core/views/statistics.py') 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