feat: remove unused recommendations code (#33960)
This commit is contained in:
@@ -6,41 +6,6 @@ from edx_toggles.toggles import WaffleFlag, WaffleSwitch
|
||||
# Namespace for student waffle flags.
|
||||
WAFFLE_FLAG_NAMESPACE = 'student'
|
||||
|
||||
# Waffle flag to enable amplitude recommendations
|
||||
# .. toggle_name: student.enable_amplitude_recommendations
|
||||
# .. toggle_implementation: WaffleFlag
|
||||
# .. toggle_default: False
|
||||
# .. toggle_description: Supports rollout of a POC for amplitude recommendations.
|
||||
# .. toggle_use_cases: temporary
|
||||
# .. toggle_creation_date: 2022-06-24
|
||||
# .. toggle_target_removal_date: None
|
||||
# .. toggle_warning: None
|
||||
# .. toggle_tickets: VAN-984
|
||||
ENABLE_AMPLITUDE_RECOMMENDATIONS = WaffleFlag(f'{WAFFLE_FLAG_NAMESPACE}.enable_amplitude_recommendations', __name__)
|
||||
|
||||
|
||||
def should_show_amplitude_recommendations():
|
||||
return ENABLE_AMPLITUDE_RECOMMENDATIONS.is_enabled()
|
||||
|
||||
|
||||
# Waffle flag to enable fallback recommendations.
|
||||
# .. toggle_name: student.enable_fallback_recommendations
|
||||
# .. toggle_implementation: WaffleFlag
|
||||
# .. toggle_default: False
|
||||
# .. toggle_description: Supports showing fallback recommendation in case of error on amplitude side.
|
||||
# Currently, fallback recommendations are picked from settings.GENERAL_RECOMMENDATIONS.
|
||||
# .. toggle_use_cases: opt_in
|
||||
# .. toggle_creation_date: 2023-01-16
|
||||
# .. toggle_target_removal_date: None
|
||||
# .. toggle_warning: None
|
||||
# .. toggle_tickets: VAN-1239
|
||||
ENABLE_FALLBACK_RECOMMENDATIONS = WaffleFlag(f'{WAFFLE_FLAG_NAMESPACE}.enable_fallback_recommendations', __name__)
|
||||
|
||||
|
||||
def show_fallback_recommendations():
|
||||
return ENABLE_FALLBACK_RECOMMENDATIONS.is_enabled()
|
||||
|
||||
|
||||
# Waffle flag to enable 2U Recommendations
|
||||
# .. toggle_name: student.enable_2u_recommendations
|
||||
# .. toggle_implementation: WaffleFlag
|
||||
|
||||
@@ -1618,7 +1618,6 @@ HOTJAR_SITE_ID = 00000
|
||||
######################## ALGOLIA SEARCH ###########################
|
||||
ALGOLIA_APP_ID = None
|
||||
ALGOLIA_SEARCH_API_KEY = None
|
||||
ALGOLIA_COURSES_RECOMMENDATION_INDEX_NAME = ''
|
||||
|
||||
######################## subdomain specific settings ###########################
|
||||
COURSE_LISTINGS = {}
|
||||
@@ -4833,19 +4832,9 @@ EDX_BRAZE_API_KEY = None
|
||||
EDX_BRAZE_API_SERVER = None
|
||||
BRAZE_COURSE_ENROLLMENT_CANVAS_ID = ''
|
||||
|
||||
### SETTINGS FOR AMPLITUDE ####
|
||||
AMPLITUDE_URL = ''
|
||||
AMPLITUDE_API_KEY = ''
|
||||
DASHBOARD_AMPLITUDE_RECOMMENDATION_ID = ''
|
||||
COURSE_ABOUT_PAGE_AMPLITUDE_RECOMMENDATION_ID = ''
|
||||
# Keeping this for back compatibility with learner dashboard api
|
||||
GENERAL_RECOMMENDATION = {}
|
||||
|
||||
GENERAL_RECOMMENDATIONS = []
|
||||
|
||||
### DEFAULT KEY DICTIONARY FOR CROSS_PRODUCT_RECOMMENDATIONS ###
|
||||
CROSS_PRODUCT_RECOMMENDATIONS_KEYS = {}
|
||||
|
||||
############### Settings for Retirement #####################
|
||||
# .. setting_name: RETIRED_USERNAME_PREFIX
|
||||
# .. setting_default: retired__user_
|
||||
|
||||
@@ -1,107 +0,0 @@
|
||||
/* global gettext */
|
||||
import React from 'react';
|
||||
import Cookies from 'js-cookie';
|
||||
|
||||
class RecommendationsPanel extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
this.domainInfo = { domain: props.sharedCookieDomain, expires: 365, path: '/' };
|
||||
this.onCourseSelect = this.onCourseSelect.bind(this);
|
||||
this.getCourseList = this.getCourseList.bind(this);
|
||||
this.state = {
|
||||
isLoading: true,
|
||||
isControl: null,
|
||||
coursesList: [],
|
||||
};
|
||||
}
|
||||
|
||||
onCourseSelect(courseKey, marketingUrl) {
|
||||
window.analytics.track('edx.bi.user.recommended.course.click', {
|
||||
course_key: courseKey,
|
||||
is_control: this.state.isControl,
|
||||
page: 'dashboard',
|
||||
});
|
||||
|
||||
window.location.href = marketingUrl;
|
||||
};
|
||||
|
||||
getCourseList = async () => {
|
||||
const coursesRecommendationData = await fetch(`${this.props.lmsRootUrl}/api/edx_recommendations/learner_dashboard/amplitude/`)
|
||||
.then(response => response.json())
|
||||
.catch(() => ({
|
||||
courses: this.props.generalRecommendations,
|
||||
}));
|
||||
|
||||
this.setState({
|
||||
coursesList: coursesRecommendationData.courses,
|
||||
isLoading: false,
|
||||
isControl: coursesRecommendationData.is_control === undefined ? null : coursesRecommendationData.is_control,
|
||||
});
|
||||
};
|
||||
|
||||
componentDidMount() {
|
||||
this.getCourseList();
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
<div className="p-4 panel-background">
|
||||
{this.state.isLoading ? (
|
||||
<div>
|
||||
<div className="recommend-heading mb-4">{gettext('Recommendations for you')}</div>
|
||||
<div className="d-flex justify-content-center align-items-center spinner-container">
|
||||
<div role="status" className="spinner">
|
||||
<span className="sr-only">{gettext('loading')}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<div>
|
||||
{this.state.coursesList.length ? (
|
||||
<div>
|
||||
<div className="recommend-heading mb-4">{gettext('Recommendations for you')}</div>
|
||||
<div>
|
||||
{this.state.coursesList.map(course => (
|
||||
<span
|
||||
role="link"
|
||||
className="course-link"
|
||||
onClick={() => this.onCourseSelect(course.course_key, course.marketing_url)}
|
||||
>
|
||||
<div className="course-card box-shadow-down-1 bg-white mb-3">
|
||||
<div className="box-shadow-down-1 image-box">
|
||||
<img
|
||||
className="panel-course-img"
|
||||
src={course.logo_image_url}
|
||||
alt="course image"
|
||||
/>
|
||||
</div>
|
||||
<div className="course-title pl-3">
|
||||
{course.title}
|
||||
</div>
|
||||
</div>
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
)}
|
||||
{this.props.exploreCoursesUrl ? (
|
||||
<div>
|
||||
{!(this.state.coursesList.length || this.state.isLoading) &&
|
||||
<div className="recommend-heading mb-2 ml-2 mr-2">{gettext('Browse recently launched courses and see what\'s new in your favorite subjects.')}</div>}
|
||||
<div className="d-flex justify-content-center">
|
||||
<a href={this.props.exploreCoursesUrl}
|
||||
className="panel-explore-courses justify-content-center align-items-center">
|
||||
{gettext('Explore courses')}
|
||||
<span className="icon fa fa-search search-icon" aria-hidden="true"/>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export {RecommendationsPanel};
|
||||
@@ -101,7 +101,6 @@ module.exports = Merge.smart({
|
||||
DemographicsCollectionModal: './lms/static/js/demographics_collection/DemographicsCollectionModal.jsx',
|
||||
AxiosJwtTokenService: './lms/static/js/jwt_auth/AxiosJwtTokenService.js',
|
||||
EnterpriseLearnerPortalModal: './lms/static/js/learner_dashboard/EnterpriseLearnerPortalModal.jsx',
|
||||
RecommendationsPanel: './lms/static/js/learner_dashboard/RecommendationsPanel.jsx',
|
||||
Static2UCallouts: './lms/static/js/learner_dashboard/Static2UCallouts.jsx',
|
||||
|
||||
// Learner Dashboard
|
||||
|
||||
Reference in New Issue
Block a user