Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion app/src/app/components/Toolbar/RecentMapsModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export const RecentMapsModal: React.FC<{
};

const handleMapDocument = (data: DocumentObject) => {
setMapDocument(data);
clear();
const urlParams = new URLSearchParams(searchParams.toString());
urlParams.set('document_id', data.document_id);
Expand Down
2 changes: 1 addition & 1 deletion app/src/app/utils/ParquetWorker/parquetWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ const ParquetWorker: ParquetWorkerClass = {
} as GeoJSON.FeatureCollection<GeoJSON.Point>;
},
async getDemography(mapDocument, brokenIds) {
const url = `${PARQUET_URL}/tabular/${mapDocument.districtr_map_slug}.parquet`;
const url = `${PARQUET_URL}/tabular/${mapDocument.gerrydb_table}.parquet`;
const meta = await this.getMetaData(url);
const ranges = this.mergeRanges(
['__parent', ...(brokenIds || [])].map(id =>
Expand Down
2 changes: 1 addition & 1 deletion backend/app/core/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def get_document_public(
literal(document_id).label("document_id"),
Document.created_at,
Document.districtr_map_slug,
Document.gerrydb_table,
DistrictrMap.gerrydb_table_name.label("gerrydb_table"), # pyright: ignore
Document.updated_at,
Document.color_scheme,
DistrictrMap.parent_layer.label("parent_layer"), # pyright: ignore
Expand Down
2 changes: 1 addition & 1 deletion backend/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ async def create_document(
Document.document_id,
Document.created_at,
Document.districtr_map_slug,
Document.gerrydb_table,
DistrictrMap.gerrydb_table_name.label("gerrydb_table"), # pyright: ignore
Document.updated_at,
DistrictrMap.uuid.label("map_uuid"), # pyright: ignore
DistrictrMap.parent_layer.label("parent_layer"), # pyright: ignore
Expand Down
16 changes: 16 additions & 0 deletions backend/app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,22 @@ def add_districtr_map_to_map_group(
DistrictrMap.districtr_map_slug == districtr_map_slug # pyright: ignore
)
).one()
existing_map_group = session.execute(
text("""
SELECT 1
FROM districtrmaps_to_groups
WHERE districtrmap_uuid = :uuid
AND group_slug = :slug
"""),
{
"uuid": districtr_map.uuid,
"slug": group_slug,
},
).one_or_none()

if existing_map_group:
session.rollback()
return

group_stmt = text("""
INSERT INTO districtrmaps_to_groups (group_slug, districtrmap_uuid)
Expand Down
Loading
Loading