2020-06-16 16:07:36 +01:00
|
|
|
|
|
|
|
import django
|
2023-01-19 21:34:09 +00:00
|
|
|
from django.db import transaction
|
2020-06-16 16:07:36 +01:00
|
|
|
|
|
|
|
import troggle.parsers.caves
|
2021-05-03 20:36:29 +01:00
|
|
|
import troggle.parsers.drawings
|
2023-01-29 17:03:50 +00:00
|
|
|
import troggle.parsers.locations
|
2020-06-16 16:07:36 +01:00
|
|
|
import troggle.parsers.logbooks
|
2023-01-19 18:33:04 +00:00
|
|
|
import troggle.parsers.people
|
2020-06-16 16:07:36 +01:00
|
|
|
import troggle.parsers.QMs
|
2023-01-19 18:33:04 +00:00
|
|
|
import troggle.parsers.scans
|
|
|
|
import troggle.settings
|
2020-06-16 16:07:36 +01:00
|
|
|
|
2023-01-19 21:18:42 +00:00
|
|
|
"""Master data import.
|
2021-04-27 20:44:24 +01:00
|
|
|
Used only by databaseReset.py and online controlpanel.
|
2023-01-19 21:18:42 +00:00
|
|
|
"""
|
|
|
|
|
2020-06-16 16:07:36 +01:00
|
|
|
def import_caves():
|
2023-01-19 21:18:42 +00:00
|
|
|
print("-- Importing Caves to ", end="")
|
|
|
|
print(django.db.connections.databases["default"]["NAME"])
|
2021-04-06 22:50:57 +01:00
|
|
|
troggle.parsers.caves.readcaves()
|
2020-06-16 16:07:36 +01:00
|
|
|
|
|
|
|
def import_people():
|
2023-01-19 21:18:42 +00:00
|
|
|
print("-- Importing People (folk.csv) to ", end="")
|
|
|
|
print(django.db.connections.databases["default"]["NAME"])
|
2020-07-22 23:06:15 +01:00
|
|
|
with transaction.atomic():
|
2021-04-15 17:51:01 +01:00
|
|
|
troggle.parsers.people.load_people_expos()
|
2020-06-16 16:07:36 +01:00
|
|
|
|
|
|
|
def import_surveyscans():
|
2023-07-23 21:30:19 +01:00
|
|
|
print("-- Importing Survey Scans and Wallets")
|
2020-07-22 23:06:15 +01:00
|
|
|
with transaction.atomic():
|
2021-05-03 20:36:29 +01:00
|
|
|
troggle.parsers.scans.load_all_scans()
|
2020-06-16 16:07:36 +01:00
|
|
|
|
|
|
|
def import_logbooks():
|
2020-07-01 22:49:38 +01:00
|
|
|
print("-- Importing Logbooks")
|
2020-07-22 23:06:15 +01:00
|
|
|
with transaction.atomic():
|
|
|
|
troggle.parsers.logbooks.LoadLogbooks()
|
2020-06-16 16:07:36 +01:00
|
|
|
|
2023-08-30 22:09:02 +01:00
|
|
|
def import_logbook(year=2023):
|
2022-12-09 23:45:07 +00:00
|
|
|
print(f"-- Importing Logbook {year}")
|
2022-12-18 19:33:56 +00:00
|
|
|
with transaction.atomic():
|
|
|
|
troggle.parsers.logbooks.LoadLogbook(year)
|
2022-12-09 23:45:07 +00:00
|
|
|
|
2020-06-16 16:07:36 +01:00
|
|
|
def import_QMs():
|
2020-07-04 01:10:53 +01:00
|
|
|
print("-- Importing old QMs for 161, 204, 234 from CSV files")
|
2020-07-22 23:06:15 +01:00
|
|
|
with transaction.atomic():
|
|
|
|
troggle.parsers.QMs.Load_QMs()
|
2020-06-16 16:07:36 +01:00
|
|
|
|
|
|
|
def import_survex():
|
|
|
|
# when this import is moved to the top with the rest it all crashes horribly
|
2021-04-27 20:44:24 +01:00
|
|
|
print("-- Importing Survex and Entrance Positions")
|
2020-07-22 23:06:15 +01:00
|
|
|
with transaction.atomic():
|
2023-01-19 21:18:42 +00:00
|
|
|
import troggle.parsers.survex
|
2020-06-16 19:27:32 +01:00
|
|
|
print(" - Survex Blocks")
|
2020-07-22 23:06:15 +01:00
|
|
|
with transaction.atomic():
|
|
|
|
troggle.parsers.survex.LoadSurvexBlocks()
|
2020-06-16 19:27:32 +01:00
|
|
|
print(" - Survex entrances x/y/z Positions")
|
2020-07-22 23:06:15 +01:00
|
|
|
with transaction.atomic():
|
2023-01-29 17:03:50 +00:00
|
|
|
troggle.parsers.locations.LoadPositions()
|
2023-01-19 21:18:42 +00:00
|
|
|
|
2022-12-22 00:56:46 +00:00
|
|
|
def import_ents():
|
|
|
|
print(" - Survex entrances x/y/z Positions")
|
|
|
|
with transaction.atomic():
|
2023-01-29 17:03:50 +00:00
|
|
|
troggle.parsers.locations.LoadPositions()
|
2023-01-19 21:18:42 +00:00
|
|
|
|
2020-06-30 15:24:42 +01:00
|
|
|
def import_loadpos():
|
2020-07-22 23:36:46 +01:00
|
|
|
print(" - Survex entrances x/y/z Positions")
|
|
|
|
with transaction.atomic():
|
2023-01-29 17:03:50 +00:00
|
|
|
troggle.parsers.locations.LoadPositions()
|
2023-01-19 21:18:42 +00:00
|
|
|
|
2020-06-30 15:52:29 +01:00
|
|
|
def import_drawingsfiles():
|
2020-07-01 22:49:38 +01:00
|
|
|
print("-- Importing Drawings files")
|
2020-07-22 23:36:46 +01:00
|
|
|
with transaction.atomic():
|
2021-05-03 20:36:29 +01:00
|
|
|
troggle.parsers.drawings.load_drawings_files()
|