2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-25 08:41:51 +00:00

More comment, to-do

This commit is contained in:
Philip Sargent 2023-08-10 23:36:56 +03:00
parent 24b5018c8d
commit c44dea4d2b

View File

@ -64,9 +64,13 @@ def logbookedit(request, year=None, slug=None):
"""Edit a logbook entry """Edit a logbook entry
This is daft: we have the parsed identity of the person and we render it to text as 'fullname', to be re-parsed on re-importing. This is daft: we have the parsed identity of the person and we render it to text as 'fullname', to be re-parsed on re-importing.
And there is no guarantee that this will be the same thing, esp. as aliases are used in the initial data input. And there is no guarantee that this will be the same thing, esp. as aliases are used in the initial data input.
So we are losing all the cute aliases that have been used over the years by this export/re-import process. Bother. So we are losing all the cute aliases that have been used over the years by this export/re-import process. Bother.
But they have already been lost in the Great Format Conversion of 2022-23 when everything was chnaged to use the same HTML parser. But they have already been lost in the Great Format Conversion of 2022-23 when everything was chnaged to use the same HTML parser.
Which is a shame. Which is a shame.
Fix is to add "alias_used" as a field in class PersonLogEntry, so that we can preserve
all those cute names. But it's rather a large manual effort (with some scripting) to recover the aliases from the original logbook
html files which are now only in the git history. Bother. Very sorry.
""" """
def clean_tu(tu): def clean_tu(tu):
if tu =="": if tu =="":
@ -81,8 +85,10 @@ def logbookedit(request, year=None, slug=None):
"""This gives each logbook entry a unique id based on the date+content, so the order of entries on a particular day """This gives each logbook entry a unique id based on the date+content, so the order of entries on a particular day
does not matter. This is a change (August 2023) from previous process. does not matter. This is a change (August 2023) from previous process.
Otherwise we could get 2023-07-20a and 2023-07-20b swapped on exporting and re-importing logbooks Otherwise we could get 2023-07-20a and 2023-07-20b swapped on exporting and re-importing logbooks
because the database does not record precendence. because the database does not record precedence.
2 hex digits would seem adequate for each expo day, but we might get a collision.. 2 hex digits would seem adequate for each expo day, but we might get a collision.
The hash is based on the content after substitution of <p> so should be stable. Which means these ids
can be used elsewhere in the troggle system as permanent slugs.
""" """
sha.update(text.encode('utf-8')) sha.update(text.encode('utf-8'))
return sha.hexdigest()[0:n] return sha.hexdigest()[0:n]