+ Permits issued: ${communityPermits}`)
layer.openPopup()
})
}
return (
- <>
-
-
- Restaurant permits issued this year: {/* TODO: display this value */}
-
-
- Maximum number of restaurant permits in a single area:
- {/* TODO: display this value */}
-
-
-
- {currentYearData.length > 0 ? (
-
+
+
+
+
+ Restaurant permits issued this year: {totalSum}
+
+
+ Maximum number of restaurant permits in a single area:
+ {" "}{maxNumPermits}
+
+
+
+
+ Permits (% of max)
+
+ -
+
+ 0–24%
+
+ -
+
+ 25–49%
+
+ -
+
+ 50–74%
+
+ -
+
+ 75–100%
+
+
+
+
+
+
+ {currentYearData.length === 0 ?
+ "Loading map data..." : ""}
+
+
+
- ) : null}
-
- >
+ {currentYearData.length > 0 ? (
+
+ ) : null}
+
+
+
)
}
diff --git a/tests/test_views.py b/tests/test_views.py
index 24cc64e..62a3594 100644
--- a/tests/test_views.py
+++ b/tests/test_views.py
@@ -6,7 +6,9 @@
from map.models import CommunityArea, RestaurantPermit
-
+# assert that the /map-data/ endpoint
+# returns the correct number of permits for Beverly and Lincoln
+# Park in 2021
@pytest.mark.django_db
def test_map_data_view():
# Create some test community areas
@@ -35,7 +37,5 @@ def test_map_data_view():
# Query the map data endpoint
client = APIClient()
response = client.get(reverse("map_data", query={"year": 2021}))
-
- # TODO: Complete the test by asserting that the /map-data/ endpoint
- # returns the correct number of permits for Beverly and Lincoln
- # Park in 2021
+ assert response.data[0].get("Beverly").get("num_permits") == 2
+ assert response.data[1].get("Lincoln Park").get("num_permits") == 3