diff --git a/RELEASE.rst b/RELEASE.rst index fb6bd42806..eeb076bdce 100644 --- a/RELEASE.rst +++ b/RELEASE.rst @@ -1,6 +1,24 @@ Release Notes ============= +Version 0.19.1 +-------------- + +- fix adornment color (#1578) +- fix homepage testimonials font (#1568) +- properly add Mit-AdornmentButton class (#1574) +- fixing cache clear method (#1573) +- add SignupPopover to learning resource drawer bookmark button (#1565) +- Delivery and availability fields for runs (#1470) +- add caching to remaining views (#1555) +- Fix refreshes and deterministic sort order (#1564) +- align items center (#1566) +- add noindex setting (#1559) +- always use dfs_query_then_fetch (#1558) +- updated OLL csv file (#1557) +- input / search input styling updates (#1545) +- Update dependency pytest to v8 (#1548) + Version 0.19.0 (Released September 16, 2024) -------------- diff --git a/app.json b/app.json index 52b749d30b..fa40538047 100644 --- a/app.json +++ b/app.json @@ -352,6 +352,10 @@ "description": "Shared secret for JWT auth tokens", "required": false }, + "MITOL_NOINDEX": { + "description": "Prevent search engines from indexing the site", + "required": false + }, "MITOL_SECURE_SSL_REDIRECT": { "description": "Application-level SSL redirect setting.", "value": "True", diff --git a/articles/views.py b/articles/views.py index e5c88c0601..472fa9f3a1 100644 --- a/articles/views.py +++ b/articles/views.py @@ -1,3 +1,5 @@ +from django.conf import settings +from django.utils.decorators import method_decorator from drf_spectacular.utils import extend_schema, extend_schema_view from rest_framework import viewsets from rest_framework.pagination import LimitOffsetPagination @@ -6,6 +8,7 @@ from articles.models import Article from articles.serializers import ArticleSerializer from main.constants import VALID_HTTP_METHODS +from main.utils import cache_page_for_all_users, clear_search_cache # Create your views here. @@ -37,3 +40,19 @@ class ArticleViewSet(viewsets.ModelViewSet): permission_classes = [IsAdminUser] http_method_names = VALID_HTTP_METHODS + + @method_decorator( + cache_page_for_all_users( + settings.SEARCH_PAGE_CACHE_DURATION, cache="redis", key_prefix="search" + ) + ) + def list(self, request, *args, **kwargs): + return super().list(request, *args, **kwargs) + + def create(self, request, *args, **kwargs): + clear_search_cache() + return super().create(request, *args, **kwargs) + + def destroy(self, request, *args, **kwargs): + clear_search_cache() + return super().destroy(request, *args, **kwargs) diff --git a/channels/views_test.py b/channels/views_test.py index 12b4e1d7dc..00c0334e7a 100644 --- a/channels/views_test.py +++ b/channels/views_test.py @@ -483,8 +483,14 @@ def test_channel_counts_view(client): ) -def test_channel_counts_view_is_cached_for_anonymous_users(client): +def test_channel_counts_view_is_cached_for_anonymous_users(client, settings): """Test the channel counts view is cached for anonymous users""" + settings.CACHES["redis"] = { + "BACKEND": "django_redis.cache.RedisCache", + "LOCATION": settings.CELERY_BROKER_URL, + "OPTIONS": {"CLIENT_CLASS": "django_redis.client.DefaultClient"}, + } + channel_count = 5 channels = ChannelFactory.create_batch(channel_count, channel_type="unit") url = reverse( @@ -499,8 +505,13 @@ def test_channel_counts_view_is_cached_for_anonymous_users(client): assert len(response) == channel_count -def test_channel_counts_view_is_cached_for_authenticated_users(client): +def test_channel_counts_view_is_cached_for_authenticated_users(client, settings): """Test the channel counts view is cached for authenticated users""" + settings.CACHES["redis"] = { + "BACKEND": "django_redis.cache.RedisCache", + "LOCATION": settings.CELERY_BROKER_URL, + "OPTIONS": {"CLIENT_CLASS": "django_redis.client.DefaultClient"}, + } channel_count = 5 channel_user = UserFactory.create() client.force_login(channel_user) diff --git a/conftest.py b/conftest.py index 0ea2a33f4d..c569bd3fce 100644 --- a/conftest.py +++ b/conftest.py @@ -20,3 +20,12 @@ def prevent_requests(mocker, request): # noqa: PT004 autospec=True, side_effect=DoNotUseRequestException, ) + + +@pytest.fixture(autouse=True) +def _use_dummy_redis_cache_backend(settings): + new_cache_settings = settings.CACHES.copy() + new_cache_settings["redis"] = { + "BACKEND": "django.core.cache.backends.dummy.DummyCache", + } + settings.CACHES = new_cache_settings diff --git a/frontends/api/src/generated/v1/api.ts b/frontends/api/src/generated/v1/api.ts index 6c13703ea6..82a3d03585 100644 --- a/frontends/api/src/generated/v1/api.ts +++ b/frontends/api/src/generated/v1/api.ts @@ -2170,6 +2170,12 @@ export interface LearningResourceRun { * @memberof LearningResourceRun */ level: Array + /** + * + * @type {Array} + * @memberof LearningResourceRun + */ + delivery: Array /** * * @type {string} @@ -2272,7 +2278,14 @@ export interface LearningResourceRun { * @memberof LearningResourceRun */ checksum?: string | null + /** + * + * @type {AvailabilityEnum} + * @memberof LearningResourceRun + */ + availability?: AvailabilityEnum | null } + /** * * @export @@ -2420,7 +2433,14 @@ export interface LearningResourceRunRequest { * @memberof LearningResourceRunRequest */ checksum?: string | null + /** + * + * @type {AvailabilityEnum} + * @memberof LearningResourceRunRequest + */ + availability?: AvailabilityEnum | null } + /** * Serializer for LearningResourceSchool model, including list of departments * @export @@ -3622,12 +3642,6 @@ export interface PercolateQuerySubscriptionRequestRequest { * @memberof PercolateQuerySubscriptionRequestRequest */ dev_mode?: boolean | null - /** - * If true sets search_type=dfs_query_then_fetch which makes Opensearchmake an extra pre-query to calculate term frequencies accross indexes - * @type {boolean} - * @memberof PercolateQuerySubscriptionRequestRequest - */ - use_dfs_query_then_fetch?: boolean | null /** * The id value for the learning resource * @type {Array} @@ -7144,7 +7158,6 @@ export const ContentFileSearchApiAxiosParamCreator = function ( * @param {Array} [run_id] The id value of the run that the content file belongs to * @param {ContentFileSearchRetrieveSortbyEnum} [sortby] if the parameter starts with \'-\' the sort is in descending order * `id` - id * `-id` - -id * `resource_readable_id` - resource_readable_id * `-resource_readable_id` - -resource_readable_id * @param {Array} [topic] The topic name. To see a list of options go to api/v1/topics/ - * @param {boolean | null} [use_dfs_query_then_fetch] If true sets search_type=dfs_query_then_fetch which makes Opensearchmake an extra pre-query to calculate term frequencies accross indexes * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -7162,7 +7175,6 @@ export const ContentFileSearchApiAxiosParamCreator = function ( run_id?: Array, sortby?: ContentFileSearchRetrieveSortbyEnum, topic?: Array, - use_dfs_query_then_fetch?: boolean | null, options: RawAxiosRequestConfig = {}, ): Promise => { const localVarPath = `/api/v1/content_file_search/` @@ -7233,11 +7245,6 @@ export const ContentFileSearchApiAxiosParamCreator = function ( localVarQueryParameter["topic"] = topic } - if (use_dfs_query_then_fetch !== undefined) { - localVarQueryParameter["use_dfs_query_then_fetch"] = - use_dfs_query_then_fetch - } - setSearchParams(localVarUrlObj, localVarQueryParameter) let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {} @@ -7279,7 +7286,6 @@ export const ContentFileSearchApiFp = function (configuration?: Configuration) { * @param {Array} [run_id] The id value of the run that the content file belongs to * @param {ContentFileSearchRetrieveSortbyEnum} [sortby] if the parameter starts with \'-\' the sort is in descending order * `id` - id * `-id` - -id * `resource_readable_id` - resource_readable_id * `-resource_readable_id` - -resource_readable_id * @param {Array} [topic] The topic name. To see a list of options go to api/v1/topics/ - * @param {boolean | null} [use_dfs_query_then_fetch] If true sets search_type=dfs_query_then_fetch which makes Opensearchmake an extra pre-query to calculate term frequencies accross indexes * @param {*} [options] Override http request option. * @throws {RequiredError} */ @@ -7297,7 +7303,6 @@ export const ContentFileSearchApiFp = function (configuration?: Configuration) { run_id?: Array, sortby?: ContentFileSearchRetrieveSortbyEnum, topic?: Array, - use_dfs_query_then_fetch?: boolean | null, options?: RawAxiosRequestConfig, ): Promise< ( @@ -7320,7 +7325,6 @@ export const ContentFileSearchApiFp = function (configuration?: Configuration) { run_id, sortby, topic, - use_dfs_query_then_fetch, options, ) const index = configuration?.serverIndex ?? 0 @@ -7376,7 +7380,6 @@ export const ContentFileSearchApiFactory = function ( requestParameters.run_id, requestParameters.sortby, requestParameters.topic, - requestParameters.use_dfs_query_then_fetch, options, ) .then((request) => request(axios, basePath)) @@ -7480,13 +7483,6 @@ export interface ContentFileSearchApiContentFileSearchRetrieveRequest { * @memberof ContentFileSearchApiContentFileSearchRetrieve */ readonly topic?: Array - - /** - * If true sets search_type=dfs_query_then_fetch which makes Opensearchmake an extra pre-query to calculate term frequencies accross indexes - * @type {boolean} - * @memberof ContentFileSearchApiContentFileSearchRetrieve - */ - readonly use_dfs_query_then_fetch?: boolean | null } /** @@ -7523,7 +7519,6 @@ export class ContentFileSearchApi extends BaseAPI { requestParameters.run_id, requestParameters.sortby, requestParameters.topic, - requestParameters.use_dfs_query_then_fetch, options, ) .then((request) => request(this.axios, this.basePath)) @@ -12650,7 +12645,6 @@ export const LearningResourcesSearchApiAxiosParamCreator = function ( * @param {number | null} [slop] Allowed distance for phrase search * @param {LearningResourcesSearchRetrieveSortbyEnum} [sortby] If the parameter starts with \'-\' the sort is in descending order * `featured` - Featured * `id` - Object ID ascending * `-id` - Object ID descending * `readable_id` - Readable ID ascending * `-readable_id` - Readable ID descending * `last_modified` - Last Modified Date ascending * `-last_modified` - Last Modified Date descending * `new` - Newest resources first * `start_date` - Start Date ascending * `-start_date` - Start Date descending * `mitcoursenumber` - MIT course number ascending * `-mitcoursenumber` - MIT course number descending * `views` - Popularity ascending * `-views` - Popularity descending * `upcoming` - Next start date ascending * @param {Array} [topic] The topic name. To see a list of options go to api/v1/topics/ - * @param {boolean | null} [use_dfs_query_then_fetch] If true sets search_type=dfs_query_then_fetch which makes Opensearchmake an extra pre-query to calculate term frequencies accross indexes * @param {number | null} [yearly_decay_percent] Relevance score penalty percent per year for for resources without upcoming runs. Only affects results if there is a search term. * @param {*} [options] Override http request option. * @throws {RequiredError} @@ -12681,7 +12675,6 @@ export const LearningResourcesSearchApiAxiosParamCreator = function ( slop?: number | null, sortby?: LearningResourcesSearchRetrieveSortbyEnum, topic?: Array, - use_dfs_query_then_fetch?: boolean | null, yearly_decay_percent?: number | null, options: RawAxiosRequestConfig = {}, ): Promise => { @@ -12802,11 +12795,6 @@ export const LearningResourcesSearchApiAxiosParamCreator = function ( localVarQueryParameter["topic"] = topic } - if (use_dfs_query_then_fetch !== undefined) { - localVarQueryParameter["use_dfs_query_then_fetch"] = - use_dfs_query_then_fetch - } - if (yearly_decay_percent !== undefined) { localVarQueryParameter["yearly_decay_percent"] = yearly_decay_percent } @@ -12866,7 +12854,6 @@ export const LearningResourcesSearchApiFp = function ( * @param {number | null} [slop] Allowed distance for phrase search * @param {LearningResourcesSearchRetrieveSortbyEnum} [sortby] If the parameter starts with \'-\' the sort is in descending order * `featured` - Featured * `id` - Object ID ascending * `-id` - Object ID descending * `readable_id` - Readable ID ascending * `-readable_id` - Readable ID descending * `last_modified` - Last Modified Date ascending * `-last_modified` - Last Modified Date descending * `new` - Newest resources first * `start_date` - Start Date ascending * `-start_date` - Start Date descending * `mitcoursenumber` - MIT course number ascending * `-mitcoursenumber` - MIT course number descending * `views` - Popularity ascending * `-views` - Popularity descending * `upcoming` - Next start date ascending * @param {Array} [topic] The topic name. To see a list of options go to api/v1/topics/ - * @param {boolean | null} [use_dfs_query_then_fetch] If true sets search_type=dfs_query_then_fetch which makes Opensearchmake an extra pre-query to calculate term frequencies accross indexes * @param {number | null} [yearly_decay_percent] Relevance score penalty percent per year for for resources without upcoming runs. Only affects results if there is a search term. * @param {*} [options] Override http request option. * @throws {RequiredError} @@ -12897,7 +12884,6 @@ export const LearningResourcesSearchApiFp = function ( slop?: number | null, sortby?: LearningResourcesSearchRetrieveSortbyEnum, topic?: Array, - use_dfs_query_then_fetch?: boolean | null, yearly_decay_percent?: number | null, options?: RawAxiosRequestConfig, ): Promise< @@ -12933,7 +12919,6 @@ export const LearningResourcesSearchApiFp = function ( slop, sortby, topic, - use_dfs_query_then_fetch, yearly_decay_percent, options, ) @@ -13002,7 +12987,6 @@ export const LearningResourcesSearchApiFactory = function ( requestParameters.slop, requestParameters.sortby, requestParameters.topic, - requestParameters.use_dfs_query_then_fetch, requestParameters.yearly_decay_percent, options, ) @@ -13192,13 +13176,6 @@ export interface LearningResourcesSearchApiLearningResourcesSearchRetrieveReques */ readonly topic?: Array - /** - * If true sets search_type=dfs_query_then_fetch which makes Opensearchmake an extra pre-query to calculate term frequencies accross indexes - * @type {boolean} - * @memberof LearningResourcesSearchApiLearningResourcesSearchRetrieve - */ - readonly use_dfs_query_then_fetch?: boolean | null - /** * Relevance score penalty percent per year for for resources without upcoming runs. Only affects results if there is a search term. * @type {number} @@ -13253,7 +13230,6 @@ export class LearningResourcesSearchApi extends BaseAPI { requestParameters.slop, requestParameters.sortby, requestParameters.topic, - requestParameters.use_dfs_query_then_fetch, requestParameters.yearly_decay_percent, options, ) @@ -13504,7 +13480,6 @@ export const LearningResourcesUserSubscriptionApiAxiosParamCreator = function ( * @param {LearningResourcesUserSubscriptionCheckListSortbyEnum} [sortby] If the parameter starts with \'-\' the sort is in descending order * `featured` - Featured * `id` - Object ID ascending * `-id` - Object ID descending * `readable_id` - Readable ID ascending * `-readable_id` - Readable ID descending * `last_modified` - Last Modified Date ascending * `-last_modified` - Last Modified Date descending * `new` - Newest resources first * `start_date` - Start Date ascending * `-start_date` - Start Date descending * `mitcoursenumber` - MIT course number ascending * `-mitcoursenumber` - MIT course number descending * `views` - Popularity ascending * `-views` - Popularity descending * `upcoming` - Next start date ascending * @param {LearningResourcesUserSubscriptionCheckListSourceTypeEnum} [source_type] The subscription type * `search_subscription_type` - search_subscription_type * `channel_subscription_type` - channel_subscription_type * @param {Array} [topic] The topic name. To see a list of options go to api/v1/topics/ - * @param {boolean | null} [use_dfs_query_then_fetch] If true sets search_type=dfs_query_then_fetch which makes Opensearchmake an extra pre-query to calculate term frequencies accross indexes * @param {number | null} [yearly_decay_percent] Relevance score penalty percent per year for for resources without upcoming runs. Only affects results if there is a search term. * @param {*} [options] Override http request option. * @throws {RequiredError} @@ -13536,7 +13511,6 @@ export const LearningResourcesUserSubscriptionApiAxiosParamCreator = function ( sortby?: LearningResourcesUserSubscriptionCheckListSortbyEnum, source_type?: LearningResourcesUserSubscriptionCheckListSourceTypeEnum, topic?: Array, - use_dfs_query_then_fetch?: boolean | null, yearly_decay_percent?: number | null, options: RawAxiosRequestConfig = {}, ): Promise => { @@ -13661,11 +13635,6 @@ export const LearningResourcesUserSubscriptionApiAxiosParamCreator = function ( localVarQueryParameter["topic"] = topic } - if (use_dfs_query_then_fetch !== undefined) { - localVarQueryParameter["use_dfs_query_then_fetch"] = - use_dfs_query_then_fetch - } - if (yearly_decay_percent !== undefined) { localVarQueryParameter["yearly_decay_percent"] = yearly_decay_percent } @@ -13712,7 +13681,6 @@ export const LearningResourcesUserSubscriptionApiAxiosParamCreator = function ( * @param {number | null} [slop] Allowed distance for phrase search * @param {LearningResourcesUserSubscriptionListSortbyEnum} [sortby] If the parameter starts with \'-\' the sort is in descending order * `featured` - Featured * `id` - Object ID ascending * `-id` - Object ID descending * `readable_id` - Readable ID ascending * `-readable_id` - Readable ID descending * `last_modified` - Last Modified Date ascending * `-last_modified` - Last Modified Date descending * `new` - Newest resources first * `start_date` - Start Date ascending * `-start_date` - Start Date descending * `mitcoursenumber` - MIT course number ascending * `-mitcoursenumber` - MIT course number descending * `views` - Popularity ascending * `-views` - Popularity descending * `upcoming` - Next start date ascending * @param {Array} [topic] The topic name. To see a list of options go to api/v1/topics/ - * @param {boolean | null} [use_dfs_query_then_fetch] If true sets search_type=dfs_query_then_fetch which makes Opensearchmake an extra pre-query to calculate term frequencies accross indexes * @param {number | null} [yearly_decay_percent] Relevance score penalty percent per year for for resources without upcoming runs. Only affects results if there is a search term. * @param {*} [options] Override http request option. * @throws {RequiredError} @@ -13743,7 +13711,6 @@ export const LearningResourcesUserSubscriptionApiAxiosParamCreator = function ( slop?: number | null, sortby?: LearningResourcesUserSubscriptionListSortbyEnum, topic?: Array, - use_dfs_query_then_fetch?: boolean | null, yearly_decay_percent?: number | null, options: RawAxiosRequestConfig = {}, ): Promise => { @@ -13864,11 +13831,6 @@ export const LearningResourcesUserSubscriptionApiAxiosParamCreator = function ( localVarQueryParameter["topic"] = topic } - if (use_dfs_query_then_fetch !== undefined) { - localVarQueryParameter["use_dfs_query_then_fetch"] = - use_dfs_query_then_fetch - } - if (yearly_decay_percent !== undefined) { localVarQueryParameter["yearly_decay_percent"] = yearly_decay_percent } @@ -13916,7 +13878,6 @@ export const LearningResourcesUserSubscriptionApiAxiosParamCreator = function ( * @param {LearningResourcesUserSubscriptionSubscribeCreateSortbyEnum} [sortby] If the parameter starts with \'-\' the sort is in descending order * `featured` - Featured * `id` - Object ID ascending * `-id` - Object ID descending * `readable_id` - Readable ID ascending * `-readable_id` - Readable ID descending * `last_modified` - Last Modified Date ascending * `-last_modified` - Last Modified Date descending * `new` - Newest resources first * `start_date` - Start Date ascending * `-start_date` - Start Date descending * `mitcoursenumber` - MIT course number ascending * `-mitcoursenumber` - MIT course number descending * `views` - Popularity ascending * `-views` - Popularity descending * `upcoming` - Next start date ascending * @param {LearningResourcesUserSubscriptionSubscribeCreateSourceTypeEnum} [source_type] The subscription type * `search_subscription_type` - search_subscription_type * `channel_subscription_type` - channel_subscription_type * @param {Array} [topic] The topic name. To see a list of options go to api/v1/topics/ - * @param {boolean | null} [use_dfs_query_then_fetch] If true sets search_type=dfs_query_then_fetch which makes Opensearchmake an extra pre-query to calculate term frequencies accross indexes * @param {number | null} [yearly_decay_percent] Relevance score penalty percent per year for for resources without upcoming runs. Only affects results if there is a search term. * @param {PercolateQuerySubscriptionRequestRequest} [PercolateQuerySubscriptionRequestRequest] * @param {*} [options] Override http request option. @@ -13949,7 +13910,6 @@ export const LearningResourcesUserSubscriptionApiAxiosParamCreator = function ( sortby?: LearningResourcesUserSubscriptionSubscribeCreateSortbyEnum, source_type?: LearningResourcesUserSubscriptionSubscribeCreateSourceTypeEnum, topic?: Array, - use_dfs_query_then_fetch?: boolean | null, yearly_decay_percent?: number | null, PercolateQuerySubscriptionRequestRequest?: PercolateQuerySubscriptionRequestRequest, options: RawAxiosRequestConfig = {}, @@ -14075,11 +14035,6 @@ export const LearningResourcesUserSubscriptionApiAxiosParamCreator = function ( localVarQueryParameter["topic"] = topic } - if (use_dfs_query_then_fetch !== undefined) { - localVarQueryParameter["use_dfs_query_then_fetch"] = - use_dfs_query_then_fetch - } - if (yearly_decay_percent !== undefined) { localVarQueryParameter["yearly_decay_percent"] = yearly_decay_percent } @@ -14198,7 +14153,6 @@ export const LearningResourcesUserSubscriptionApiFp = function ( * @param {LearningResourcesUserSubscriptionCheckListSortbyEnum} [sortby] If the parameter starts with \'-\' the sort is in descending order * `featured` - Featured * `id` - Object ID ascending * `-id` - Object ID descending * `readable_id` - Readable ID ascending * `-readable_id` - Readable ID descending * `last_modified` - Last Modified Date ascending * `-last_modified` - Last Modified Date descending * `new` - Newest resources first * `start_date` - Start Date ascending * `-start_date` - Start Date descending * `mitcoursenumber` - MIT course number ascending * `-mitcoursenumber` - MIT course number descending * `views` - Popularity ascending * `-views` - Popularity descending * `upcoming` - Next start date ascending * @param {LearningResourcesUserSubscriptionCheckListSourceTypeEnum} [source_type] The subscription type * `search_subscription_type` - search_subscription_type * `channel_subscription_type` - channel_subscription_type * @param {Array} [topic] The topic name. To see a list of options go to api/v1/topics/ - * @param {boolean | null} [use_dfs_query_then_fetch] If true sets search_type=dfs_query_then_fetch which makes Opensearchmake an extra pre-query to calculate term frequencies accross indexes * @param {number | null} [yearly_decay_percent] Relevance score penalty percent per year for for resources without upcoming runs. Only affects results if there is a search term. * @param {*} [options] Override http request option. * @throws {RequiredError} @@ -14230,7 +14184,6 @@ export const LearningResourcesUserSubscriptionApiFp = function ( sortby?: LearningResourcesUserSubscriptionCheckListSortbyEnum, source_type?: LearningResourcesUserSubscriptionCheckListSourceTypeEnum, topic?: Array, - use_dfs_query_then_fetch?: boolean | null, yearly_decay_percent?: number | null, options?: RawAxiosRequestConfig, ): Promise< @@ -14267,7 +14220,6 @@ export const LearningResourcesUserSubscriptionApiFp = function ( sortby, source_type, topic, - use_dfs_query_then_fetch, yearly_decay_percent, options, ) @@ -14312,7 +14264,6 @@ export const LearningResourcesUserSubscriptionApiFp = function ( * @param {number | null} [slop] Allowed distance for phrase search * @param {LearningResourcesUserSubscriptionListSortbyEnum} [sortby] If the parameter starts with \'-\' the sort is in descending order * `featured` - Featured * `id` - Object ID ascending * `-id` - Object ID descending * `readable_id` - Readable ID ascending * `-readable_id` - Readable ID descending * `last_modified` - Last Modified Date ascending * `-last_modified` - Last Modified Date descending * `new` - Newest resources first * `start_date` - Start Date ascending * `-start_date` - Start Date descending * `mitcoursenumber` - MIT course number ascending * `-mitcoursenumber` - MIT course number descending * `views` - Popularity ascending * `-views` - Popularity descending * `upcoming` - Next start date ascending * @param {Array} [topic] The topic name. To see a list of options go to api/v1/topics/ - * @param {boolean | null} [use_dfs_query_then_fetch] If true sets search_type=dfs_query_then_fetch which makes Opensearchmake an extra pre-query to calculate term frequencies accross indexes * @param {number | null} [yearly_decay_percent] Relevance score penalty percent per year for for resources without upcoming runs. Only affects results if there is a search term. * @param {*} [options] Override http request option. * @throws {RequiredError} @@ -14343,7 +14294,6 @@ export const LearningResourcesUserSubscriptionApiFp = function ( slop?: number | null, sortby?: LearningResourcesUserSubscriptionListSortbyEnum, topic?: Array, - use_dfs_query_then_fetch?: boolean | null, yearly_decay_percent?: number | null, options?: RawAxiosRequestConfig, ): Promise< @@ -14379,7 +14329,6 @@ export const LearningResourcesUserSubscriptionApiFp = function ( slop, sortby, topic, - use_dfs_query_then_fetch, yearly_decay_percent, options, ) @@ -14425,7 +14374,6 @@ export const LearningResourcesUserSubscriptionApiFp = function ( * @param {LearningResourcesUserSubscriptionSubscribeCreateSortbyEnum} [sortby] If the parameter starts with \'-\' the sort is in descending order * `featured` - Featured * `id` - Object ID ascending * `-id` - Object ID descending * `readable_id` - Readable ID ascending * `-readable_id` - Readable ID descending * `last_modified` - Last Modified Date ascending * `-last_modified` - Last Modified Date descending * `new` - Newest resources first * `start_date` - Start Date ascending * `-start_date` - Start Date descending * `mitcoursenumber` - MIT course number ascending * `-mitcoursenumber` - MIT course number descending * `views` - Popularity ascending * `-views` - Popularity descending * `upcoming` - Next start date ascending * @param {LearningResourcesUserSubscriptionSubscribeCreateSourceTypeEnum} [source_type] The subscription type * `search_subscription_type` - search_subscription_type * `channel_subscription_type` - channel_subscription_type * @param {Array} [topic] The topic name. To see a list of options go to api/v1/topics/ - * @param {boolean | null} [use_dfs_query_then_fetch] If true sets search_type=dfs_query_then_fetch which makes Opensearchmake an extra pre-query to calculate term frequencies accross indexes * @param {number | null} [yearly_decay_percent] Relevance score penalty percent per year for for resources without upcoming runs. Only affects results if there is a search term. * @param {PercolateQuerySubscriptionRequestRequest} [PercolateQuerySubscriptionRequestRequest] * @param {*} [options] Override http request option. @@ -14458,7 +14406,6 @@ export const LearningResourcesUserSubscriptionApiFp = function ( sortby?: LearningResourcesUserSubscriptionSubscribeCreateSortbyEnum, source_type?: LearningResourcesUserSubscriptionSubscribeCreateSourceTypeEnum, topic?: Array, - use_dfs_query_then_fetch?: boolean | null, yearly_decay_percent?: number | null, PercolateQuerySubscriptionRequestRequest?: PercolateQuerySubscriptionRequestRequest, options?: RawAxiosRequestConfig, @@ -14493,7 +14440,6 @@ export const LearningResourcesUserSubscriptionApiFp = function ( sortby, source_type, topic, - use_dfs_query_then_fetch, yearly_decay_percent, PercolateQuerySubscriptionRequestRequest, options, @@ -14595,7 +14541,6 @@ export const LearningResourcesUserSubscriptionApiFactory = function ( requestParameters.sortby, requestParameters.source_type, requestParameters.topic, - requestParameters.use_dfs_query_then_fetch, requestParameters.yearly_decay_percent, options, ) @@ -14639,7 +14584,6 @@ export const LearningResourcesUserSubscriptionApiFactory = function ( requestParameters.slop, requestParameters.sortby, requestParameters.topic, - requestParameters.use_dfs_query_then_fetch, requestParameters.yearly_decay_percent, options, ) @@ -14684,7 +14628,6 @@ export const LearningResourcesUserSubscriptionApiFactory = function ( requestParameters.sortby, requestParameters.source_type, requestParameters.topic, - requestParameters.use_dfs_query_then_fetch, requestParameters.yearly_decay_percent, requestParameters.PercolateQuerySubscriptionRequestRequest, options, @@ -14900,13 +14843,6 @@ export interface LearningResourcesUserSubscriptionApiLearningResourcesUserSubscr */ readonly topic?: Array - /** - * If true sets search_type=dfs_query_then_fetch which makes Opensearchmake an extra pre-query to calculate term frequencies accross indexes - * @type {boolean} - * @memberof LearningResourcesUserSubscriptionApiLearningResourcesUserSubscriptionCheckList - */ - readonly use_dfs_query_then_fetch?: boolean | null - /** * Relevance score penalty percent per year for for resources without upcoming runs. Only affects results if there is a search term. * @type {number} @@ -15096,13 +15032,6 @@ export interface LearningResourcesUserSubscriptionApiLearningResourcesUserSubscr */ readonly topic?: Array - /** - * If true sets search_type=dfs_query_then_fetch which makes Opensearchmake an extra pre-query to calculate term frequencies accross indexes - * @type {boolean} - * @memberof LearningResourcesUserSubscriptionApiLearningResourcesUserSubscriptionList - */ - readonly use_dfs_query_then_fetch?: boolean | null - /** * Relevance score penalty percent per year for for resources without upcoming runs. Only affects results if there is a search term. * @type {number} @@ -15299,13 +15228,6 @@ export interface LearningResourcesUserSubscriptionApiLearningResourcesUserSubscr */ readonly topic?: Array - /** - * If true sets search_type=dfs_query_then_fetch which makes Opensearchmake an extra pre-query to calculate term frequencies accross indexes - * @type {boolean} - * @memberof LearningResourcesUserSubscriptionApiLearningResourcesUserSubscriptionSubscribeCreate - */ - readonly use_dfs_query_then_fetch?: boolean | null - /** * Relevance score penalty percent per year for for resources without upcoming runs. Only affects results if there is a search term. * @type {number} @@ -15382,7 +15304,6 @@ export class LearningResourcesUserSubscriptionApi extends BaseAPI { requestParameters.sortby, requestParameters.source_type, requestParameters.topic, - requestParameters.use_dfs_query_then_fetch, requestParameters.yearly_decay_percent, options, ) @@ -15428,7 +15349,6 @@ export class LearningResourcesUserSubscriptionApi extends BaseAPI { requestParameters.slop, requestParameters.sortby, requestParameters.topic, - requestParameters.use_dfs_query_then_fetch, requestParameters.yearly_decay_percent, options, ) @@ -15475,7 +15395,6 @@ export class LearningResourcesUserSubscriptionApi extends BaseAPI { requestParameters.sortby, requestParameters.source_type, requestParameters.topic, - requestParameters.use_dfs_query_then_fetch, requestParameters.yearly_decay_percent, requestParameters.PercolateQuerySubscriptionRequestRequest, options, @@ -16375,8 +16294,7 @@ export const LearningpathsApiAxiosParamCreator = function ( } }, /** - * Get a list of related learning resources for a learning resource. - * @summary Nested Learning Resource List + * Viewset for LearningPath related resources * @param {number} learning_resource_id The learning resource id of the learning path * @param {number} [limit] Number of results to return per page. * @param {number} [offset] The initial index from which to return the results. @@ -16959,8 +16877,7 @@ export const LearningpathsApiFp = function (configuration?: Configuration) { )(axios, operationBasePath || basePath) }, /** - * Get a list of related learning resources for a learning resource. - * @summary Nested Learning Resource List + * Viewset for LearningPath related resources * @param {number} learning_resource_id The learning resource id of the learning path * @param {number} [limit] Number of results to return per page. * @param {number} [offset] The initial index from which to return the results. @@ -17313,8 +17230,7 @@ export const LearningpathsApiFactory = function ( .then((request) => request(axios, basePath)) }, /** - * Get a list of related learning resources for a learning resource. - * @summary Nested Learning Resource List + * Viewset for LearningPath related resources * @param {LearningpathsApiLearningpathsItemsListRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} @@ -17853,8 +17769,7 @@ export class LearningpathsApi extends BaseAPI { } /** - * Get a list of related learning resources for a learning resource. - * @summary Nested Learning Resource List + * Viewset for LearningPath related resources * @param {LearningpathsApiLearningpathsItemsListRequest} requestParameters Request parameters. * @param {*} [options] Override http request option. * @throws {RequiredError} diff --git a/frontends/api/src/test-utils/factories/learningResources.ts b/frontends/api/src/test-utils/factories/learningResources.ts index 7de5efb2e0..8c11ddf195 100644 --- a/frontends/api/src/test-utils/factories/learningResources.ts +++ b/frontends/api/src/test-utils/factories/learningResources.ts @@ -28,6 +28,8 @@ import type { VideoResource, } from "api" import { + AvailabilityEnum, + DeliveryEnum, ResourceTypeEnum, LearningResourceRunLevelInnerCodeEnum, PlatformEnum, @@ -177,6 +179,13 @@ const learningResourceRun: Factory = (overrides = {}) => { languages: maybe(() => repeat(language, { min: 0, max: 3 })), start_date: start.toISOString(), end_date: end.toISOString(), + availability: faker.helpers.arrayElement(Object.values(AvailabilityEnum)), + delivery: [ + { + code: faker.helpers.arrayElement(Object.values(DeliveryEnum)), + name: uniqueEnforcerWords.enforce(() => faker.lorem.words()), + }, + ], level: [ { code: faker.helpers.arrayElement( diff --git a/frontends/mit-learn/public/index.html b/frontends/mit-learn/public/index.html index 3a53a522fa..db71cb559f 100644 --- a/frontends/mit-learn/public/index.html +++ b/frontends/mit-learn/public/index.html @@ -3,6 +3,9 @@ + <% if (MITOL_NOINDEX) { %> + + <% } %>