2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-26 17:21:52 +00:00
troggle/parsers/imports.py

77 lines
2.3 KiB
Python

import django
from django.db import transaction
import troggle.parsers.caves
import troggle.parsers.drawings
import troggle.parsers.locations
import troggle.parsers.logbooks
import troggle.parsers.people
import troggle.parsers.QMs
import troggle.parsers.scans
import troggle.settings
"""Master data import.
Used only by databaseReset.py and online controlpanel.
"""
def import_caves():
print("-- Importing Caves to ", end="")
print(django.db.connections.databases["default"]["NAME"])
troggle.parsers.caves.readcaves()
def import_people():
print("-- Importing People (folk.csv) to ", end="")
print(django.db.connections.databases["default"]["NAME"])
with transaction.atomic():
troggle.parsers.people.load_people_expos()
def import_surveyscans():
print("-- Importing Survey Scans and Wallets")
with transaction.atomic():
troggle.parsers.scans.load_all_scans()
def import_logbooks():
print("-- Importing Logbooks")
with transaction.atomic():
troggle.parsers.logbooks.LoadLogbooks()
def import_logbook(year=2023):
print(f"-- Importing Logbook {year}")
with transaction.atomic():
troggle.parsers.logbooks.LoadLogbook(year)
def import_QMs():
print("-- Importing old QMs for 161, 204, 234 from CSV files")
with transaction.atomic():
troggle.parsers.QMs.Load_QMs()
def import_survex():
# when this import is moved to the top with the rest it all crashes horribly
print("-- Importing Survex and Entrance Positions")
with transaction.atomic():
import troggle.parsers.survex
print(" - Survex Blocks")
with transaction.atomic():
troggle.parsers.survex.LoadSurvexBlocks()
print(" - Survex entrances x/y/z Positions")
with transaction.atomic():
troggle.parsers.survex.caveifywallets()
with transaction.atomic():
troggle.parsers.locations.LoadPositions()
def import_ents():
print(" - Survex entrances x/y/z Positions")
with transaction.atomic():
troggle.parsers.locations.LoadPositions()
def import_loadpos():
print(" - Survex entrances x/y/z Positions")
with transaction.atomic():
troggle.parsers.locations.LoadPositions()
def import_drawingsfiles():
print("-- Importing Drawings files")
with transaction.atomic():
troggle.parsers.drawings.load_drawings_files()