Database: Add weighing_reason to delivery_part
This commit is contained in:
@ -542,6 +542,7 @@ CREATE TABLE delivery_part (
|
||||
|
||||
scale_id TEXT,
|
||||
weighing_id TEXT,
|
||||
weighing_reason TEXT CHECK (NOT (manual_weighing = TRUE AND weighing_reason IS NOT NULL)),
|
||||
|
||||
comment TEXT DEFAULT NULL,
|
||||
ctime INTEGER NOT NULL DEFAULT (UNIXEPOCH()),
|
||||
|
@ -1354,7 +1354,7 @@ def migrate_deliveries(in_dir: str, out_dir: str) -> None:
|
||||
f_delivery.header('year', 'did', 'date', 'time', 'zwstid', 'lnr', 'lsnr', 'mgnr', 'comment')
|
||||
f_part.header('year', 'did', 'dpnr', 'sortid', 'weight', 'kmw', 'qualid', 'hkid', 'kgnr', 'rdnr',
|
||||
'gerebelt', 'manual_weighing', 'spl_check', 'hand_picked', 'lesewagen',
|
||||
'temperature', 'acid', 'scale_id', 'weighing_id', 'comment')
|
||||
'temperature', 'acid', 'scale_id', 'weighing_id', 'weighing_reason', 'comment')
|
||||
f_attr.header('year', 'did', 'dpnr', 'attrid')
|
||||
|
||||
for lsnr, linrs, date in fixed:
|
||||
@ -1475,19 +1475,21 @@ def migrate_deliveries(in_dir: str, out_dir: str) -> None:
|
||||
if comment.startswith('Säure'):
|
||||
acid = float(comment.split(' ')[-1].replace(',', '.'))
|
||||
comment = None
|
||||
elif comment == 'Maschine':
|
||||
elif comment in ('Maschine', 'Masschine'):
|
||||
hand = False
|
||||
comment = None
|
||||
elif comment == 'Hand':
|
||||
hand = True
|
||||
comment = None
|
||||
elif comment == '.':
|
||||
comment = None
|
||||
if comment:
|
||||
comments.append(comment)
|
||||
gerebelt = True if CLIENT == WG.MATZEN or (CLIENT == WG.WINZERKELLER and zwstid == 'W') else d['Gerebelt'] or False
|
||||
f_part.row(
|
||||
date.year, snr, dpnr, sortid, int(d['Gewicht']), kmw, qualid, hkid, kgnr, rdnr,
|
||||
gerebelt, handwiegung, d['Spaetlese-Ueberpruefung'] or False,
|
||||
hand, lesemaschine, d['Temperatur'], acid, scale_id, weighing_id, comment
|
||||
hand, lesemaschine, d['Temperatur'], acid, scale_id, weighing_id, None, comment
|
||||
)
|
||||
for attrid in attributes:
|
||||
f_attr.row(date.year, snr, dpnr, attrid)
|
||||
|
Reference in New Issue
Block a user