There was an error while loading. Please reload this page.
1 parent bbe493f commit 3578323Copy full SHA for 3578323
1 file changed
backend/app/utils.py
@@ -330,6 +330,22 @@ def add_districtr_map_to_map_group(
330
DistrictrMap.districtr_map_slug == districtr_map_slug # pyright: ignore
331
)
332
).one()
333
+ existing_map_group = session.execute(
334
+ text("""
335
+ SELECT 1
336
+ FROM districtrmaps_to_groups
337
+ WHERE districtrmap_uuid = :uuid
338
+ AND group_slug = :slug
339
+ """),
340
+ {
341
+ "uuid": districtr_map.uuid,
342
+ "slug": group_slug,
343
+ },
344
+ ).one_or_none()
345
+
346
+ if existing_map_group:
347
+ session.commit()
348
+ return
349
350
group_stmt = text("""
351
INSERT INTO districtrmaps_to_groups (group_slug, districtrmap_uuid)
0 commit comments