Skip to content

Commit

Permalink
pass topics sorted to stringlist used for slugs and identificators. a…
Browse files Browse the repository at this point in the history
…s well mssql behaves like gpkg from the naming. and finalizing those tests
  • Loading branch information
signedav committed Oct 27, 2023
1 parent 9145c95 commit 069f54e
Show file tree
Hide file tree
Showing 4 changed files with 235 additions and 339 deletions.
4 changes: 2 additions & 2 deletions modelbaker/dataobjects/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,9 @@ def store_variables(self, project):
Set the layer variables according to the strategy
"""
interlis_topics = ",".join(
self.all_topics
sorted(self.all_topics)
if project.optimize_strategy == OptimizeStrategy.NONE
else self.relevant_topics
else sorted(self.relevant_topics)
)
QgsExpressionContextUtils.setLayerVariable(
self.__layer, "interlis_topic", interlis_topics
Expand Down
3 changes: 2 additions & 1 deletion modelbaker/dataobjects/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,11 @@ def create(
"AllowAddFeatures": False,
"FilterExpression": "\"topic\" IN ({}) and attribute(get_feature('{}', 't_id', \"dataset\"), 'datasetname') != '{}'".format(
",".join(
[f"'{topic}'" for topic in filter_topics]
[f"'{topic}'" for topic in sorted(filter_topics)]
), # create comma separated string
"T_ILI2DB_DATASET"
if referenced_layer.provider == "ogr"
or referenced_layer.provider == "mssql"
else "t_ili2db_dataset",
self.context.get("catalogue_datasetname", ""),
)
Expand Down
4 changes: 2 additions & 2 deletions modelbaker/generator/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,9 @@ def layers(self, filter_layer_list=[]):
if self.basket_handling and column_name in BASKET_FIELDNAMES:
# on NONE strategy those should be all topics the class could be in. On optimized strategies GROUP/HIDE only the relevant topics should be listed.
interlis_topics = ",".join(
layer.all_topics
sorted(layer.all_topics)
if self.optimize_strategy == OptimizeStrategy.NONE
else layer.relevant_topics
else sorted(layer.relevant_topics)
)

# and set the default value (to be used from the projet variables)
Expand Down
Loading

0 comments on commit 069f54e

Please sign in to comment.