mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 06:47:07 +00:00
Skip info for saillines with no preplot.
It may happen that the sailline info file has data for more lines than are actually in the preplot (e.g., if importing a reduced preplot file). In this case, we don't want a constraint violation error due to missing corresponding lines in `preplot_lines` so we check for that and only import lines that do exist in `preplot_lines`
This commit is contained in:
@@ -274,11 +274,27 @@ class Datastore:
|
|||||||
with self.conn.cursor() as cursor:
|
with self.conn.cursor() as cursor:
|
||||||
cursor.execute("BEGIN;")
|
cursor.execute("BEGIN;")
|
||||||
|
|
||||||
|
# Check which preplot lines we actually have already imported,
|
||||||
|
# as the line info file may contain extra lines.
|
||||||
|
|
||||||
|
qry = """
|
||||||
|
SELECT line, class
|
||||||
|
FROM preplot_lines
|
||||||
|
ORDER BY line, class;
|
||||||
|
"""
|
||||||
|
cursor.execute(qry)
|
||||||
|
preplot_lines = cursor.fetchall()
|
||||||
|
|
||||||
hash = self.add_file(filepath, cursor)
|
hash = self.add_file(filepath, cursor)
|
||||||
count=0
|
count=0
|
||||||
for line in lines:
|
for line in lines:
|
||||||
count += 1
|
count += 1
|
||||||
print(f"\u001b[2KSaving line {count} / {len(lines)}", end="\r", flush=True)
|
|
||||||
|
if not (line["sail_line"], "V") in preplot_lines:
|
||||||
|
print(f"\u001b[2KSkipping line {count} / {len(lines)}", end="\n", flush=True)
|
||||||
|
continue
|
||||||
|
|
||||||
|
print(f"\u001b[2KSaving line {count} / {len(lines)} ", end="\n", flush=True)
|
||||||
|
|
||||||
sail_line = line["sail_line"]
|
sail_line = line["sail_line"]
|
||||||
incr = line.get("incr", True)
|
incr = line.get("incr", True)
|
||||||
|
|||||||
Reference in New Issue
Block a user