Since many people only take some of the MBTA lines, they may only want some of them in their calendar.
Changes
This pull adds the optional line query parameter to the /calendar route to filter shutdowns by line. One, multiple, or no lines may be specified.
The line names are currently validated against shutdowns.json and will return a 400 bad request if an unknown line is specified. This relies on shutdown.json listing empty arrays if a line does not have any shutdowns planned; if this cannot be guaranteed then I will remove this check and unknown lines will be silently discarded.
This PR only adds this feature to the backend for now (I am not experienced with React).
EDIT: Force pushes to fix lint.
Testing Instructions
To generate a calendar with only shutdowns on the Red line:
/calendar?line=red
To generate a calendar with only shutdowns on the Red and Green lines:
/calendar?line=red&line=green
To generate a calendar with all shutdowns (backward compatible):
Motivation
Since many people only take some of the MBTA lines, they may only want some of them in their calendar.
Changes
This pull adds the optional
line
query parameter to the/calendar
route to filter shutdowns by line. One, multiple, or no lines may be specified.The line names are currently validated against
shutdowns.json
and will return a 400 bad request if an unknown line is specified. This relies onshutdown.json
listing empty arrays if a line does not have any shutdowns planned; if this cannot be guaranteed then I will remove this check and unknown lines will be silently discarded.This PR only adds this feature to the backend for now (I am not experienced with React).
EDIT: Force pushes to fix lint.
Testing Instructions