From 75834902f24f2fb90afa120a160ee23cdb4551f0 Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Thu, 26 Jan 2023 23:36:56 +0000 Subject: [PATCH] new report on tehrion file parsing --- core/views/statistics.py | 18 ++++++++++++++++-- templates/controlPanel.html | 6 +++--- templates/therionreport.html | 4 +++- 3 files changed, 22 insertions(+), 6 deletions(-) diff --git a/core/views/statistics.py b/core/views/statistics.py index 726aebb..28bc721 100644 --- a/core/views/statistics.py +++ b/core/views/statistics.py @@ -3,6 +3,7 @@ import operator import os.path import re from collections import OrderedDict +from pathlib import Path import django.db.models from django.db.models import Max, Min @@ -22,9 +23,22 @@ from troggle.parsers.people import (GetPersonExpeditionNameLookup, #from django.views.generic.list import ListView def therionissues(request): - theriondict = {} + logname = "therionrefs.log" + logpath = (Path(settings.PYTHON_PATH, logname)) + therionlog = [] + newlog = [] - return render(request, 'therionreport.html', {"theriondict":theriondict}) + if Path(logpath).is_file: + with open(logpath, "r") as f: + therionlog = f.readlines() + print(f"{logpath} has {len(therionlog)} entries") + else: + print(f"{logpath} NOT FOUND {len(therionlog)}") + + for line in therionlog: + line = line.replace("! Un-parsed image filename:", "") + 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 diff --git a/templates/controlPanel.html b/templates/controlPanel.html index a1a4510..825a664 100644 --- a/templates/controlPanel.html +++ b/templates/controlPanel.html @@ -24,7 +24,7 @@
  • Folder paths used -folders settings used by this troggle installation
  • Expoer name aliases -short names recognised by troggle
  • Data Issues on Imports - warnings and errors from the recent data import -
  • Therion Import issues - warnings from the recent data import +
  • Therion Import issues - warnings from the recent data import

  • Django admin - Deep magic access to all models and data

    This control panel is being redeveloped

    @@ -36,13 +36,13 @@
  • We are working on an on-line importer for new survex files - with syntax checking
  • Logbooks can only be exported in the current format. -

    Today (Dec. 2022) we use the databaseReset program to import from the master files. This is run on the server itself only by nerds who remotely log in to the server using ssh. +

    Today (Jan. 2023) we use the databaseReset program to import from the master files. This is run on the server itself only by nerds who remotely log in to the server using ssh.

    Before you even think about doing database imports, you should understand the implications on everyone else. See the Troggle documentation.

    As soon as you can cope, you should read the source code for databaseReset to see what it does, as the details are not documented anywhere else yet. But at least the code is quite well commented. -

    The logbook export capability is used to convert an archaic logbook into the new logbook format. When all the old logbooks have been converted, we won't need this any more. (Neither will we need the old format parser). +

    The logbook export capability wass used to convert an archaic logbook into the current logbook format. It exports the logbook entries in the database into a new file, with the entries in date order. But there is no use for this capability now (Jan. 2023).

    diff --git a/templates/therionreport.html b/templates/therionreport.html index 42a4786..7844f7f 100644 --- a/templates/therionreport.html +++ b/templates/therionreport.html @@ -4,8 +4,10 @@ {% block content %}

    Expo Therion import issues report

    +

    ! Un-parsed image filename

    -{% for line in theriondict %} +{% for line in therionlog %} +{{line}}
    {% empty %} No Therion parsing output found. Re-import all drawings using databaseReset.py {% endfor %}