diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-03-20 16:02:51 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2025-03-20 16:07:40 +0100 |
commit | ac3adb815091e4157bce75542f40e12257add364 (patch) | |
tree | 119f98a5defa41b55e534d8792207557d393e378 | |
parent | caf3138871b7cba6d76a83d4d7ae5123fddf1b8e (diff) | |
download | Ishtar-ac3adb815091e4157bce75542f40e12257add364.tar.bz2 Ishtar-ac3adb815091e4157bce75542f40e12257add364.zip |
🐛 sheet geo: fix label on map view for markers (refs #6234)
-rw-r--r-- | archaeological_context_records/models.py | 6 | ||||
-rw-r--r-- | ishtar_common/models_common.py | 12 |
2 files changed, 10 insertions, 8 deletions
diff --git a/archaeological_context_records/models.py b/archaeological_context_records/models.py index 29e8b56a8..30d2d9ad7 100644 --- a/archaeological_context_records/models.py +++ b/archaeological_context_records/models.py @@ -1131,15 +1131,15 @@ class ContextRecord( profile = get_current_profile() precision = profile.point_precision - + current_geodata = list(self.geodata.values_list("id", flat=True)) - + q = self.base_finds.filter(main_geodata__isnull=False) url = base_url + "/show-basefind/{}/" collection_finds = GeoVectorData._get_geo_item_list( q, current_geodata, url, precision, rounded ) - + dct["finds"] = { "type": "FeatureCollection", "features": collection_finds, diff --git a/ishtar_common/models_common.py b/ishtar_common/models_common.py index d7b7c3e21..96eb26bbf 100644 --- a/ishtar_common/models_common.py +++ b/ishtar_common/models_common.py @@ -2662,29 +2662,31 @@ class GeoVectorData(Imported, OwnPerms): @classmethod def _get_geo_item_list(cls, q, current_geodata, url, precision, rounded): - collection_id = [] - items_id = [] - q = q.values("main_geodata", "id") + collection_id, items = [], [] + q = q.values("main_geodata", "id", "cached_label") for item in q.distinct().all(): geodata_id = item["main_geodata"] if geodata_id not in current_geodata: collection_id.append(geodata_id) - items_id.append(item["id"]) + items.append((item["id"], item["cached_label"])) current_geodata.append(geodata_id) collection = [] for idx in range(len(collection_id)): geo = json.loads(GeoVectorData.objects.get(pk=collection_id[idx]).geojson) geo_type = geo.get("type", None) - url_geo = url.format(items_id[idx]) + current_id, label = items[idx] + url_geo = url.format(current_id) if geo_type == "FeatureCollection": for feat in geo["features"]: if "properties" in feat: feat["properties"]["url"] = url_geo + feat["properties"]["name"] = label collection += geo["features"] elif geo_type: if "properties" in geo: geo["properties"]["url"] = url_geo + geo["properties"]["name"] = label collection.append(geo) if not precision and rounded: |