Skip to content

Commit 7ab24c7

Browse files
author
msj
committed
Redact challenge portions
1 parent 467196c commit 7ab24c7

2 files changed

Lines changed: 18 additions & 24 deletions

File tree

map/static/js/RestaurantPermitMap.js

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ function YearSelect({ setFilterVal }) {
3737
}
3838

3939
export default function RestaurantPermitMap() {
40-
const colors = ["#eff3ff", "#bdd7e7", "#6baed6", "#2171b5"]
41-
40+
const communityAreaColors = ["#eff3ff", "#bdd7e7", "#6baed6", "#2171b5"]
41+
4242
const [currentYearData, setCurrentYearData] = useState([])
4343
const [year, setYear] = useState(2026)
4444

@@ -55,22 +55,20 @@ export default function RestaurantPermitMap() {
5555
}, [yearlyDataEndpoint])
5656

5757

58-
function getColor(pcntPermits) {
59-
if (pcntPermits > .5)
60-
return colors[3]
61-
else if (pcntPermits > .2)
62-
return colors [2]
63-
else if (pcntPermits >= .01)
64-
return colors [1]
65-
else
66-
return colors[0]
58+
function getColor(percentageOfPermits) {
59+
/**
60+
* TODO: Use this function in setAreaInteraction to set a community
61+
* area's color using the communityAreaColors constant above
62+
*/
6763
}
68-
64+
6965
function setAreaInteraction(feature, layer) {
7066
/**
71-
* TODO: use the methods below to:
72-
* 1) shade each area according to how many permits it had in a year
73-
* 2) display a popup with area details during user interaction
67+
* TODO: Use the methods below to:
68+
* 1) Shade each community area according to what percentage of
69+
* permits were issued there in the selected year
70+
* 2) On hover, display a popup with the community area's raw
71+
* permit count for the year
7472
*/
7573
layer.setStyle()
7674
layer.on("", () => {

tests/test_views.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
@pytest.mark.django_db
1111
def test_map_data_view():
12-
# Create some community areas
12+
# Create some test community areas
1313
area1 = CommunityArea.objects.create(name="Beverly", area_id="1")
1414
area2 = CommunityArea.objects.create(name="Lincoln Park", area_id="2")
1515

@@ -32,14 +32,10 @@ def test_map_data_view():
3232
community_area_id=area2.area_id, issue_date=date(2021, 6, 22)
3333
)
3434

35+
# Query the map data endpoint
3536
client = APIClient()
3637
response = client.get(reverse("map_data", query={"year": 2021}))
3738

38-
expected_response = [
39-
{"name": "Beverly", "num_permits": 2},
40-
{"name": "Lincoln Park", "num_permits": 3},
41-
]
42-
43-
assert (
44-
response.json() == expected_response
45-
), "Should return the number of permits for each community area"
39+
# TODO: Complete the test by asserting that the /map-data/ endpoint
40+
# returns the correct number of permits for Beverly and Lincoln
41+
# Park in 2021

0 commit comments

Comments
 (0)