mirror of
https://github.com/ARUP-CAS/aiscr-qgis-amcr-viewer.git
synced 2026-06-19 04:12:55 +02:00
Fixed DJs handling logic and filtering negative DJs
This commit is contained in:
+11
-27
@@ -133,27 +133,6 @@ def load_amcr_data(canvas, bb, filters=None):
|
|||||||
piani = akce.get('az_dj_pian', [])
|
piani = akce.get('az_dj_pian', [])
|
||||||
if not piani: continue
|
if not piani: continue
|
||||||
|
|
||||||
# negative_pians = set()
|
|
||||||
# # Pokud je aktivní filtr 'posevidence', projdeme dokumentační jednotky
|
|
||||||
# if filters and filters.get('posevidence') == 'true':
|
|
||||||
# djs = akce.get('az_dokumentacni_jednotka', [])
|
|
||||||
# for dj in djs:
|
|
||||||
# # Pokud je jednotka negativní
|
|
||||||
# if dj.get('dj_negativni_jednotka') is True:
|
|
||||||
# # Získáme ID pianu z objektu (např. {"id": "P-...", "value": "..."})
|
|
||||||
# pian_obj = dj.get('dj_pian')
|
|
||||||
# if pian_obj and isinstance(pian_obj, dict):
|
|
||||||
# negative_pians.add(pian_obj.get('id'))
|
|
||||||
|
|
||||||
# djs = akce.get('az_dokumentacni_jednotka', [])
|
|
||||||
# for dj in djs:
|
|
||||||
# is_negative = dj.get('dj_negativni_jednotka')
|
|
||||||
# if is_negative is True or str(is_negative).lower() == 'true':
|
|
||||||
# # Získáme ID pianu z objektu (např. {"id": "P-...", "value": "..."})
|
|
||||||
# pian_obj = dj.get('dj_pian')
|
|
||||||
# if pian_obj and isinstance(pian_obj, dict):
|
|
||||||
# negative_dj_pian_ids.add(pian_obj.get('id'))
|
|
||||||
|
|
||||||
actions_with_geom += 1
|
actions_with_geom += 1
|
||||||
|
|
||||||
def g(key, default=""):
|
def g(key, default=""):
|
||||||
@@ -204,17 +183,22 @@ def load_amcr_data(canvas, bb, filters=None):
|
|||||||
# pian_lookup[pid] = meta
|
# pian_lookup[pid] = meta
|
||||||
# target_pian_ids.add(pid)
|
# target_pian_ids.add(pid)
|
||||||
|
|
||||||
djs = akce.get('az_dokumentacni_jednotka')
|
djs = akce.get('az_dokumentacni_jednotka', [])
|
||||||
|
|
||||||
for dj in djs:
|
for dj in djs:
|
||||||
meta['dj_id'] = dj.get('ident_cely')
|
if filters and filters.get('posevidence') == 'true' and dj.get('dj_negativni_jednotka') is True:
|
||||||
|
continue
|
||||||
|
dj_meta = meta.copy()
|
||||||
|
dj_meta['dj_id'] = dj.get('ident_cely')
|
||||||
dj_typ = dj.get('dj_typ')
|
dj_typ = dj.get('dj_typ')
|
||||||
meta['dj_typ_value'] = dj_typ.get('value')
|
dj_meta['dj_typ_value'] = dj_typ.get('value') if dj_typ else ""
|
||||||
meta['dj_negativni'] = "Negativní" if dj.get('dj_negativni_jednotka') is True else "Pozitivní"
|
dj_meta['dj_negativni'] = "Negativní" if dj.get('dj_negativni_jednotka') is True else "Pozitivní"
|
||||||
dj_pian = dj.get('dj_pian')
|
dj_pian = dj.get('dj_pian')
|
||||||
dj_pian_value = dj_pian.get('value')
|
if dj_pian:
|
||||||
|
dj_pian_value = dj_pian.get('id')
|
||||||
|
if dj_pian_value:
|
||||||
target_pian_ids.add(dj_pian_value)
|
target_pian_ids.add(dj_pian_value)
|
||||||
pian_lookup[dj_pian_value] = meta
|
pian_lookup[dj_pian_value] = dj_meta
|
||||||
|
|
||||||
if not target_pian_ids:
|
if not target_pian_ids:
|
||||||
iface.messageBar().pushMessage("AMCR", f"Nalezeno {len(docs_akce)} akcí, ale žádná nemá geometrii.", level=1)
|
iface.messageBar().pushMessage("AMCR", f"Nalezeno {len(docs_akce)} akcí, ale žádná nemá geometrii.", level=1)
|
||||||
|
|||||||
Reference in New Issue
Block a user