This PR revises the logic surrounding dates. Previously, we were showing either the "Starts" or "As taught in" fields, based on the output of shouldShowAnytime. This function takes a LearningResource and returns true if its availability property is set to "anytime" and its resource_type is "course" or "program." Now, if availability is "anytime" then the "Starts" field will show "Anytime," otherwise it will show the start dates. The "As taught in" field also appears if availability is "anytime," but if no dates are returned from totalRunsWithDates, then it will be hidden.
Screenshots (if appropriate):
How can this be tested?
If you have Posthog set up locally, enable the lr_drawer_v2 flag
If you don't have Posthog set up locally, you can force drawerV2 to be true in LearningResourceDrawer.tsx
Spin up this branch of mit-learn
Ensure you have sufficient data backpopulated into your local instance, including some OCW and Sloan courses
What are the relevant tickets?
Closes https://github.com/mitodl/hq/issues/6075
Description (What does it do?)
This PR revises the logic surrounding dates. Previously, we were showing either the "Starts" or "As taught in" fields, based on the output of
shouldShowAnytime
. This function takes aLearningResource
and returnstrue
if itsavailability
property is set to "anytime" and itsresource_type
is "course" or "program." Now, ifavailability
is "anytime" then the "Starts" field will show "Anytime," otherwise it will show the start dates. The "As taught in" field also appears ifavailability
is "anytime," but if no dates are returned fromtotalRunsWithDates
, then it will be hidden.Screenshots (if appropriate):
How can this be tested?
lr_drawer_v2
flagdrawerV2
to betrue
inLearningResourceDrawer.tsx
mit-learn
availability
, such as "Generative AI Business Sprint"