Skip to content

Commit

Permalink
Merge pull request #624 from opengisch/ogr_dataset_table
Browse files Browse the repository at this point in the history
Fix basket handling with geopackage
  • Loading branch information
signedav authored Dec 23, 2021
2 parents 39c6f33 + 7395e95 commit 20d15bd
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions QgisModelBaker/libqgsprojectgen/dataobjects/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,12 @@ def create(self, path: str, qgis_project: QgsProject):
"ShowOpenFormButton": False,
"AllowNULL": True,
"AllowAddFeatures": False,
"FilterExpression": "\"topic\" = '{}' and attribute(get_feature('t_ili2db_dataset', 't_id', \"dataset\"), 'datasetname') != '{}'".format(
referencing_layer.model_topic_name, CATALOGUE_DATASETNAME
"FilterExpression": "\"topic\" = '{}' and attribute(get_feature('{}', 't_id', \"dataset\"), 'datasetname') != '{}'".format(
referencing_layer.model_topic_name,
"T_ILI2DB_DATASET"
if referenced_layer.provider == "ogr"
else "t_ili2db_dataset",
CATALOGUE_DATASETNAME,
)
if referencing_layer.model_topic_name
else "",
Expand Down
2 changes: 1 addition & 1 deletion QgisModelBaker/libqgsprojectgen/generator/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def layers(self, filter_layer_list=[]):
field.default_value_expression = (
f"@{schema_topic_identificator}"
)
elif self.tool == DbIliMode.ili2gpkg:
elif self.tool in [DbIliMode.ili2gpkg, DbIliMode.gpkg]:
schema_topic_identificator = slugify(
f"@{layer.source().uri().split('|')[0].strip()}_{model_topic_name}"
)
Expand Down
2 changes: 1 addition & 1 deletion QgisModelBaker/tests/test_projectgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -2642,7 +2642,7 @@ def test_kbs_geopackage_basket_handling(self):
)
assert (
map["FilterExpression"]
== "\"topic\" = 'KbS_LV95_V1_3.Belastete_Standorte' and attribute(get_feature('t_ili2db_dataset', 't_id', \"dataset\"), 'datasetname') != 'Catalogueset'"
== "\"topic\" = 'KbS_LV95_V1_3.Belastete_Standorte' and attribute(get_feature('T_ILI2DB_DATASET', 't_id', \"dataset\"), 'datasetname') != 'Catalogueset'"
)

# check the display expression of the basket table
Expand Down

0 comments on commit 20d15bd

Please sign in to comment.