From e9367251e22f4b434f0122b49b2e6bf761c5507a Mon Sep 17 00:00:00 2001 From: zamanafzal Date: Mon, 24 Jul 2023 03:48:40 +0500 Subject: [PATCH] feat: productize course review experiment --- .../course/course-header/CourseHeader.jsx | 33 ++----------------- .../course-header/tests/CourseHeader.test.jsx | 3 -- src/index.jsx | 2 -- 3 files changed, 2 insertions(+), 36 deletions(-) diff --git a/src/components/course/course-header/CourseHeader.jsx b/src/components/course/course-header/CourseHeader.jsx index 3353ffbb4d..67fbc9f033 100644 --- a/src/components/course/course-header/CourseHeader.jsx +++ b/src/components/course/course-header/CourseHeader.jsx @@ -1,4 +1,4 @@ -import React, { useContext, useEffect, useMemo } from 'react'; +import React, { useContext, useMemo } from 'react'; import classNames from 'classnames'; import { Breadcrumb, @@ -8,8 +8,6 @@ import { } from '@edx/paragon'; import { Link } from 'react-router-dom'; import { AppContext } from '@edx/frontend-platform/react'; -import { getConfig } from '@edx/frontend-platform/config'; -import { sendEnterpriseTrackEvent } from '@edx/frontend-enterprise-utils'; import { CourseContext } from '../CourseContextProvider'; import CourseSkills from '../CourseSkills'; @@ -25,7 +23,6 @@ import LicenseRequestedAlert from '../LicenseRequestedAlert'; import SubsidyRequestButton from '../SubsidyRequestButton'; import CourseReview from '../CourseReview'; -import { isExperimentVariant } from '../../../utils/optimizely'; import CoursePreview from './CoursePreview'; const CourseHeader = () => { @@ -34,7 +31,6 @@ const CourseHeader = () => { state: { course, catalog, - courseReviews, }, isPolicyRedemptionEnabled, } = useContext(CourseContext); @@ -44,31 +40,6 @@ const CourseHeader = () => { () => getDefaultProgram(course.programs), [course], ); - const config = getConfig(); - const isExperimentVariationA = isExperimentVariant( - config.EXPERIMENT_5_ID, - config.EXPERIMENT_5_VARIANT_1_ID, - ); - const hasSufficientReviewCount = courseReviews?.reviewsCount >= 5; - useEffect(() => { - if (hasSufficientReviewCount && isExperimentVariationA) { - sendEnterpriseTrackEvent( - enterpriseConfig.uuid, - 'edx.ui.enterprise.learner_portal.course.viewedWithReviewsVariation', - { - course_key: course.key, - }, - ); - } else { - sendEnterpriseTrackEvent( - enterpriseConfig.uuid, - 'edx.ui.enterprise.learner_portal.course.viewedWithoutReviewsVariation', - { - course_key: course.key, - }, - ); - } - }, [hasSufficientReviewCount, isExperimentVariationA, enterpriseConfig.uuid, course.key]); return (
@@ -137,7 +108,7 @@ const CourseHeader = () => { {catalog.containsContentItems ? ( <> - {hasSufficientReviewCount && isExperimentVariationA && } + {defaultProgram && (

This course is part of a {formatProgramType(defaultProgram.type)}. diff --git a/src/components/course/course-header/tests/CourseHeader.test.jsx b/src/components/course/course-header/tests/CourseHeader.test.jsx index 9663fbd94d..0863e71ece 100644 --- a/src/components/course/course-header/tests/CourseHeader.test.jsx +++ b/src/components/course/course-header/tests/CourseHeader.test.jsx @@ -13,7 +13,6 @@ import CourseHeader from '../CourseHeader'; import { COURSE_PACING_MAP } from '../../data/constants'; import { TEST_OWNER } from '../../tests/data/constants'; import { CourseEnrollmentsContext } from '../../../dashboard/main-content/course-enrollments/CourseEnrollmentsContextProvider'; -import * as optimizelyUtils from '../../../../utils/optimizely'; jest.mock('react-router-dom', () => ({ useLocation: jest.fn(), @@ -162,7 +161,6 @@ describe('', () => { }); test('renders course reviews section', () => { - jest.spyOn(optimizelyUtils, 'isExperimentVariant').mockImplementation(() => true); render( ', () => { }); test('renders course reviews section and change the review information content', () => { - jest.spyOn(optimizelyUtils, 'isExperimentVariant').mockImplementation(() => true); render(