From 1152e39cac65e91ab014abb647d3f89241482721 Mon Sep 17 00:00:00 2001 From: alex-m-brown Date: Thu, 18 Dec 2025 15:41:52 -0500 Subject: [PATCH 1/2] remove misc templates js firehose events --- apps/src/templates/VersionHistory.jsx | 17 ---- .../VersionHistoryWithCommitsDialog.jsx | 17 ---- .../templates/courseOverview/CourseScript.js | 14 --- .../templates/feedback/LevelFeedbackEntry.jsx | 9 -- .../LessonNavigationDropdown.jsx | 22 +---- .../lessonOverview/LessonOverview.jsx | 43 ++-------- .../templates/lessonOverview/ResourceList.jsx | 56 ++---------- .../activities/LevelDetailsDialog.jsx | 18 +--- .../activities/ProgressionDetails.jsx | 12 --- .../sectionAssessments/FeedbackDownload.jsx | 5 +- .../sectionAssessments/SectionAssessments.jsx | 60 ++----------- .../SubmissionStatusAssessmentsContainer.jsx | 2 - .../MarketingAnnouncementBanner.jsx | 19 ----- .../JoinLink/JoinLinkCopyButton.tsx | 23 ----- .../src/templates/tables/QuickActionsCell.jsx | 4 - .../teacherDashboard/OwnedSections.jsx | 34 -------- .../teacherDashboard/impressionHelpers.js | 10 --- .../teacherDashboard/teacherSectionsRedux.ts | 85 +------------------ .../teacherDashboardShared/UnitSelectorV2.jsx | 21 ----- 19 files changed, 25 insertions(+), 446 deletions(-) delete mode 100644 apps/src/templates/teacherDashboard/impressionHelpers.js diff --git a/apps/src/templates/VersionHistory.jsx b/apps/src/templates/VersionHistory.jsx index 2b6aa75eae862..f73b714bc22ea 100644 --- a/apps/src/templates/VersionHistory.jsx +++ b/apps/src/templates/VersionHistory.jsx @@ -2,7 +2,6 @@ import PropTypes from 'prop-types'; import React from 'react'; import project from '@cdo/apps/code-studio/initApp/project'; -import firehoseClient from '@cdo/apps/metrics/firehose'; import i18n from '@cdo/locale'; import {sources as sourcesApi, files as filesApi} from '../clientApi'; @@ -115,22 +114,6 @@ export default class VersionHistory extends React.Component { onClearPuzzle = () => { this.setState({showSpinner: true}); - firehoseClient.putRecord( - { - study: 'project-data-integrity', - study_group: 'v4', - event: 'clear-puzzle', - project_id: project.getCurrentId(), - data_json: JSON.stringify({ - isOwner: project.isOwner(), - currentUrl: window.location.href, - shareUrl: project.getShareUrl(), - isProjectTemplateLevel: this.props.isProjectTemplateLevel, - currentSourceVersionId: project.getCurrentSourceVersionId(), - }), - }, - {includeUserId: true} - ); this.props .handleClearPuzzle() diff --git a/apps/src/templates/VersionHistoryWithCommitsDialog.jsx b/apps/src/templates/VersionHistoryWithCommitsDialog.jsx index d93c8a95e6071..3fe85c2bff61a 100644 --- a/apps/src/templates/VersionHistoryWithCommitsDialog.jsx +++ b/apps/src/templates/VersionHistoryWithCommitsDialog.jsx @@ -3,7 +3,6 @@ import React from 'react'; import project from '@cdo/apps/code-studio/initApp/project'; import Button from '@cdo/apps/legacySharedComponents/Button'; -import firehoseClient from '@cdo/apps/metrics/firehose'; import StylizedBaseDialog from '@cdo/apps/sharedComponents/StylizedBaseDialog'; import color from '@cdo/apps/util/color'; import i18n from '@cdo/locale'; @@ -108,22 +107,6 @@ export default class VersionHistoryWithCommitsDialog extends React.Component { onClearPuzzle = () => { this.setState({showSpinner: true}); - firehoseClient.putRecord( - { - study: 'project-data-integrity', - study_group: 'v4', - event: 'clear-puzzle', - project_id: project.getCurrentId(), - data_json: JSON.stringify({ - isOwner: project.isOwner(), - currentUrl: window.location.href, - shareUrl: project.getShareUrl(), - isProjectTemplateLevel: this.props.isProjectTemplateLevel, - currentSourceVersionId: project.getCurrentSourceVersionId(), - }), - }, - {includeUserId: true} - ); this.props .handleClearPuzzle() diff --git a/apps/src/templates/courseOverview/CourseScript.js b/apps/src/templates/courseOverview/CourseScript.js index 60c90c9d73247..22782ecee3b28 100644 --- a/apps/src/templates/courseOverview/CourseScript.js +++ b/apps/src/templates/courseOverview/CourseScript.js @@ -9,7 +9,6 @@ import { import {ViewType} from '@cdo/apps/code-studio/viewAsRedux'; import fontConstants from '@cdo/apps/fontConstants'; import Button from '@cdo/apps/legacySharedComponents/Button'; -import firehoseClient from '@cdo/apps/metrics/firehose'; import Assigned from '@cdo/apps/templates/Assigned'; import SafeMarkdown from '@cdo/apps/templates/SafeMarkdown'; import {sectionForDropdownShape} from '@cdo/apps/templates/teacherDashboard/shapes'; @@ -62,19 +61,6 @@ class CourseScript extends Component { onClickHiddenToggle = value => { const {name, selectedSectionId, id, toggleHiddenScript} = this.props; toggleHiddenScript(name, selectedSectionId, id, value === 'hidden'); - firehoseClient.putRecord( - { - study: 'hidden-units', - study_group: 'v0', - event: value, - script_id: id, - data_json: JSON.stringify({ - script_name: name, - section_id: selectedSectionId, - }), - }, - {useProgressScriptId: false} - ); }; render() { diff --git a/apps/src/templates/feedback/LevelFeedbackEntry.jsx b/apps/src/templates/feedback/LevelFeedbackEntry.jsx index 3a8c09562ec47..0090cc10a613c 100644 --- a/apps/src/templates/feedback/LevelFeedbackEntry.jsx +++ b/apps/src/templates/feedback/LevelFeedbackEntry.jsx @@ -4,7 +4,6 @@ import ReactDOM from 'react-dom'; import fontConstants from '@cdo/apps/fontConstants'; import FontAwesome from '@cdo/apps/legacySharedComponents/FontAwesome'; -import firehoseClient from '@cdo/apps/metrics/firehose'; import {ReviewStates} from '@cdo/apps/templates/feedback/types'; import {KeepWorkingBadge} from '@cdo/apps/templates/progress/BubbleBadge'; import {UnlocalizedTimeAgo as TimeAgo} from '@cdo/apps/templates/TimeAgo'; @@ -120,14 +119,6 @@ function Comment({commentText, feedbackSeenByStudent, feedbackId}) { const expandComment = () => { setExpanded(true); - firehoseClient.putRecord( - { - study: 'all-feedback', - event: 'expand-feedback', - data_json: {feedback_id: feedbackId}, - }, - {includeUserId: true} - ); }; const collapseComment = () => { diff --git a/apps/src/templates/lessonOverview/LessonNavigationDropdown.jsx b/apps/src/templates/lessonOverview/LessonNavigationDropdown.jsx index 6b65560afcc22..5a3f630e30db0 100644 --- a/apps/src/templates/lessonOverview/LessonNavigationDropdown.jsx +++ b/apps/src/templates/lessonOverview/LessonNavigationDropdown.jsx @@ -3,7 +3,6 @@ import React, {Component} from 'react'; import fontConstants from '@cdo/apps/fontConstants'; import Button from '@cdo/apps/legacySharedComponents/Button'; -import firehoseClient from '@cdo/apps/metrics/firehose'; import DropdownButton from '@cdo/apps/templates/DropdownButton'; import {navigationLessonShape} from '@cdo/apps/templates/lessonOverview/lessonPlanShapes'; import color from '@cdo/apps/util/color'; @@ -39,26 +38,7 @@ export default class LessonNavigationDropdown extends Component { handleDropdownClick = (e, listItem) => { e.preventDefault(); if (listItem.link) { - firehoseClient.putRecord( - { - study: 'lesson-plan', - study_group: this.props.isStudentLessonPlan - ? 'student-lesson-plan' - : 'teacher-lesson-plan', - event: 'navigate-between-lessons', - data_int: this.props.lesson.id, - data_json: JSON.stringify({ - startingLessonId: this.props.lesson.id, - endingLessonId: listItem.id, - }), - }, - { - includeUserId: true, - callback: () => { - navigateToHref(linkWithQueryParams(listItem.link)); - }, - } - ); + navigateToHref(linkWithQueryParams(listItem.link)); } else { this.setState({currentSection: listItem.sectionNumber}); } diff --git a/apps/src/templates/lessonOverview/LessonOverview.jsx b/apps/src/templates/lessonOverview/LessonOverview.jsx index 01f9ee380e81d..2ceb4e14b6dc5 100644 --- a/apps/src/templates/lessonOverview/LessonOverview.jsx +++ b/apps/src/templates/lessonOverview/LessonOverview.jsx @@ -8,7 +8,6 @@ import {PublishedState} from '@cdo/apps/generated/curriculum/sharedCourseConstan import Button from '@cdo/apps/legacySharedComponents/Button'; import {EVENTS, PLATFORMS} from '@cdo/apps/metrics/AnalyticsConstants'; import analyticsReporter from '@cdo/apps/metrics/AnalyticsReporter'; -import firehoseClient from '@cdo/apps/metrics/firehose'; import styleConstants from '@cdo/apps/styleConstants'; import CopyrightInfo from '@cdo/apps/templates/CopyrightInfo'; import VerifiedResourcesNotification from '@cdo/apps/templates/courseOverview/VerifiedResourcesNotification'; @@ -71,31 +70,13 @@ class LessonOverview extends Component { ); } - recordAndHandleResource = (e, firehoseKey, action, url = null) => { + handleResource = (e, action, url = null) => { e.preventDefault(); // Prevent navigation to url until callback - const event = - action === ResourceActions.NAVIGATE ? 'open-pdf' : 'print-from-browser'; - firehoseClient.putRecord( - { - study: 'pdf-click', - study_group: 'lesson', - event: event, - data_json: JSON.stringify({ - name: this.props.lesson.key, - pdfType: firehoseKey, - }), - }, - { - includeUserId: true, - callback: () => { - if (action === ResourceActions.NAVIGATE && url) { - window.location.href = url; // Navigate to the URL - } else if (action === ResourceActions.PRINT) { - window.print(); // Trigger the print dialog - } - }, - } - ); + if (action === ResourceActions.NAVIGATE && url) { + window.location.href = url; // Navigate to the URL + } else if (action === ResourceActions.PRINT) { + window.print(); // Trigger the print dialog + } return false; }; @@ -132,12 +113,7 @@ class LessonOverview extends Component { - this.recordAndHandleResource( - e, - option.key, - ResourceActions.NAVIGATE, - option.url - ) + this.handleResource(e, ResourceActions.NAVIGATE, option.url) } href={option.url} > @@ -149,7 +125,7 @@ class LessonOverview extends Component { - this.recordAndHandleResource(e, WINDOW_PRINT, ResourceActions.PRINT) + this.handleResource(e, WINDOW_PRINT, ResourceActions.PRINT) } href="#" > @@ -209,9 +185,6 @@ class LessonOverview extends Component { announcements={announcements} width={styleConstants['content-width']} viewAs={viewAs} - firehoseAnalyticsData={{ - lesson_id: lesson.id, - }} /> )} {displayVerifiedResourcesNotification && ( diff --git a/apps/src/templates/lessonOverview/ResourceList.jsx b/apps/src/templates/lessonOverview/ResourceList.jsx index f26d1e9725874..b1f67c99b9d86 100644 --- a/apps/src/templates/lessonOverview/ResourceList.jsx +++ b/apps/src/templates/lessonOverview/ResourceList.jsx @@ -5,7 +5,6 @@ import Button from '@cdo/apps/legacySharedComponents/Button'; import localization from '@cdo/apps/localization'; import {EVENTS} from '@cdo/apps/metrics/AnalyticsConstants'; import analyticsReporter from '@cdo/apps/metrics/AnalyticsReporter'; -import firehoseClient from '@cdo/apps/metrics/firehose'; import {windowOpen} from '@cdo/apps/utils'; import i18n from '@cdo/locale'; @@ -52,30 +51,10 @@ export default class ResourceList extends Component { e.preventDefault(); this.sendLinkVisitedEvent(resource, 'download'); - - firehoseClient.putRecord( - { - study: - this.props.pageType === 'resources-rollup' - ? 'course-rollup-pages' - : 'lesson-plan', - study_group: this.props.pageType, - event: 'download-resource', - data_int: resource.id, - data_json: JSON.stringify({ - resourceId: resource.id, - }), - }, - { - includeUserId: true, - callback: () => { - windowOpen( - this.normalizeUrl(this.localizedDownloadURL(resource)), - 'noopener', - 'noreferrer' - ); - }, - } + windowOpen( + this.normalizeUrl(this.localizedDownloadURL(resource)), + 'noopener', + 'noreferrer' ); }; @@ -84,29 +63,10 @@ export default class ResourceList extends Component { this.sendLinkVisitedEvent(resource, 'open'); - firehoseClient.putRecord( - { - study: - this.props.pageType === 'resources-rollup' - ? 'rollup-pages' - : 'lesson-plan', - study_group: this.props.pageType, - event: 'open-resource', - data_int: resource.id, - data_json: JSON.stringify({ - resourceId: resource.id, - }), - }, - { - includeUserId: true, - callback: () => { - windowOpen( - this.normalizeUrl(this.localizedURL(resource)), - 'noopener', - 'noreferrer' - ); - }, - } + windowOpen( + this.normalizeUrl(this.localizedURL(resource)), + 'noopener', + 'noreferrer' ); }; diff --git a/apps/src/templates/lessonOverview/activities/LevelDetailsDialog.jsx b/apps/src/templates/lessonOverview/activities/LevelDetailsDialog.jsx index 0b5875938b217..123e9b1ccc199 100644 --- a/apps/src/templates/lessonOverview/activities/LevelDetailsDialog.jsx +++ b/apps/src/templates/lessonOverview/activities/LevelDetailsDialog.jsx @@ -9,7 +9,6 @@ import SublevelCard from '@cdo/apps/code-studio/components/SublevelCard'; import {createVideoWithFallback} from '@cdo/apps/code-studio/videos'; import {ViewType} from '@cdo/apps/code-studio/viewAsRedux'; import Button from '@cdo/apps/legacySharedComponents/Button'; -import firehoseClient from '@cdo/apps/metrics/firehose'; import styleConstants from '@cdo/apps/styleConstants'; import BaseDialog from '@cdo/apps/templates/BaseDialog'; import TeacherOnlyMarkdown from '@cdo/apps/templates/instructions/TeacherOnlyMarkdown'; @@ -212,22 +211,7 @@ class LevelDetailsDialog extends Component { recordSeeFullLevelClick = (e, url, scriptLevel) => { e.preventDefault(); - firehoseClient.putRecord( - { - study: 'lesson-plan', - study_group: 'teacher-lesson-plan', - event: 'click-see-full-level', - data_json: JSON.stringify({ - scriptLevelId: scriptLevel.id, - }), - }, - { - includeUserId: true, - callback: () => { - windowOpen(url, 'noopener', 'noreferrer'); - }, - } - ); + windowOpen(url, 'noopener', 'noreferrer'); }; handleBubbleChoiceBubbleClick = clickedObject => { diff --git a/apps/src/templates/lessonOverview/activities/ProgressionDetails.jsx b/apps/src/templates/lessonOverview/activities/ProgressionDetails.jsx index 91b3ca489b2e1..d77e1f75a5a16 100644 --- a/apps/src/templates/lessonOverview/activities/ProgressionDetails.jsx +++ b/apps/src/templates/lessonOverview/activities/ProgressionDetails.jsx @@ -1,7 +1,6 @@ import PropTypes from 'prop-types'; import React, {Component} from 'react'; -import firehoseClient from '@cdo/apps/metrics/firehose'; import ProgressLevelSet from '@cdo/apps/templates/progress/ProgressLevelSet'; import {LevelStatus} from '@cdo/generated-scripts/sharedConstants'; @@ -18,17 +17,6 @@ export default class ProgressionDetails extends Component { handleBubbleClick = level => { this.setState({previewingLevel: level}); - firehoseClient.putRecord( - { - study: 'lesson-plan', - study_group: 'teacher-lesson-plan', - event: 'click-level-preview', - data_json: JSON.stringify({ - scriptLevelId: level.id, - }), - }, - {includeUserId: true} - ); }; convertScriptLevelForProgression = scriptLevel => { diff --git a/apps/src/templates/sectionAssessments/FeedbackDownload.jsx b/apps/src/templates/sectionAssessments/FeedbackDownload.jsx index dff974735aacd..45faa8854ac0f 100644 --- a/apps/src/templates/sectionAssessments/FeedbackDownload.jsx +++ b/apps/src/templates/sectionAssessments/FeedbackDownload.jsx @@ -51,7 +51,6 @@ const CSV_FEEDBACK_NO_RUBRIC_HEADERS = [ class FeedbackDownload extends Component { static propTypes = { sectionName: PropTypes.string.isRequired, - onClickDownload: PropTypes.func.isRequired, // provided by redux exportableFeedbackData: PropTypes.array.isRequired, scriptName: PropTypes.string.isRequired, @@ -73,8 +72,7 @@ class FeedbackDownload extends Component { } render() { - const {sectionName, exportableFeedbackData, scriptName, onClickDownload} = - this.props; + const {sectionName, exportableFeedbackData, scriptName} = this.props; // These allow the CSVLink to be styled as a button let className = classNames( @@ -94,7 +92,6 @@ class FeedbackDownload extends Component { })} data={exportableFeedbackData} headers={this.headers} - onClick={onClickDownload} style={styles.buttonContainer} className={className} > diff --git a/apps/src/templates/sectionAssessments/SectionAssessments.jsx b/apps/src/templates/sectionAssessments/SectionAssessments.jsx index b2e8f657bb108..c6befafdc530e 100644 --- a/apps/src/templates/sectionAssessments/SectionAssessments.jsx +++ b/apps/src/templates/sectionAssessments/SectionAssessments.jsx @@ -20,7 +20,6 @@ import UnitSelector from '@cdo/apps/templates/sectionProgress/UnitSelector'; import i18n from '@cdo/locale'; import {h3Style} from '../../legacySharedComponents/Headings'; -import firehoseClient from '../../metrics/firehose'; import AssessmentSelector from './AssessmentSelector'; import FeedbackDownload from './FeedbackDownload'; @@ -89,61 +88,21 @@ class SectionAssessments extends Component { } onSelectScript = (newScriptId, newCourseVersionId) => { - const {setUnit, asyncLoadAssessments, scriptId, sectionId} = this.props; + const {setUnit, asyncLoadAssessments, sectionId} = this.props; asyncLoadAssessments(sectionId, newScriptId, newCourseVersionId); setUnit(newScriptId, newCourseVersionId); - - this.logEvent('select_script', { - old_script_id: scriptId, - new_script_id: newScriptId, - }); }; onSelectAssessment = newAssessmentId => { - const {setAssessmentId, assessmentId, scriptId} = this.props; + const {setAssessmentId} = this.props; setAssessmentId(newAssessmentId); - - this.logEvent('select_assessment', { - script_id: scriptId, - old_level_group_id: assessmentId, - new_level_group_id: newAssessmentId, - }); }; onSelectStudent = studentId => { - const {setStudentId, assessmentId, scriptId} = this.props; + const {setStudentId} = this.props; setStudentId(studentId); - - this.logEvent('select_student', { - student_id: studentId, - script_id: scriptId, - level_group_id: assessmentId, - }); }; - onClickDownload(dataType) { - const {assessmentId, scriptId} = this.props; - this.logEvent(`download_${dataType}`, { - script_id: scriptId, - level_group_id: assessmentId, - }); - } - - logEvent(event, data) { - firehoseClient.putRecord( - { - study: 'teacher_dashboard_actions', - study_group: 'assessments_surveys', - event: event, - data_json: JSON.stringify({ - section_id: this.props.sectionId, - ...data, - }), - }, - {includeUserId: true} - ); - } - showFreeResponseDetailDialog = () => { this.setState({ freeResponseDetailDialogOpen: true, @@ -245,7 +204,6 @@ class SectionAssessments extends Component { filename="assessments.csv" data={exportableData} headers={CSV_ASSESSMENT_HEADERS} - onClick={() => this.onClickDownload('assessments')} >
{i18n.downloadAssessmentCSV()}
@@ -254,11 +212,7 @@ class SectionAssessments extends Component { {totalStudentSubmissions <= 0 && (
{i18n.emptyAssessmentSubmissions()}
)} - - this.onClickDownload('submission_stats') - } - /> + {totalStudentSubmissions > 0 && (
this.onClickDownload('feedback')} - /> + )} {/* Surveys */} {isCurrentAssessmentSurvey && ( @@ -294,7 +245,6 @@ class SectionAssessments extends Component { filename="surveys.csv" data={exportableData} headers={CSV_SURVEY_HEADERS} - onClick={() => this.onClickDownload('surveys')} >
{i18n.downloadAssessmentCSV()}
diff --git a/apps/src/templates/sectionAssessments/SubmissionStatusAssessmentsContainer.jsx b/apps/src/templates/sectionAssessments/SubmissionStatusAssessmentsContainer.jsx index 670ad6b309e0d..10bc3840f9ddc 100644 --- a/apps/src/templates/sectionAssessments/SubmissionStatusAssessmentsContainer.jsx +++ b/apps/src/templates/sectionAssessments/SubmissionStatusAssessmentsContainer.jsx @@ -36,7 +36,6 @@ const CSV_SUBMISSION_STATUS_HEADERS = [ class SubmissionStatusAssessmentsContainer extends Component { static propTypes = { - onClickDownload: PropTypes.func.isRequired, // from redux localeCode: PropTypes.string, studentExportableData: PropTypes.arrayOf(studentExportableDataPropType), @@ -60,7 +59,6 @@ class SubmissionStatusAssessmentsContainer extends Component { filename="assessments-submission-status.csv" data={this.props.studentExportableData} headers={CSV_SUBMISSION_STATUS_HEADERS} - onClick={this.props.onClickDownload} style={styles.button} className={className} > diff --git a/apps/src/templates/studioHomepages/MarketingAnnouncementBanner.jsx b/apps/src/templates/studioHomepages/MarketingAnnouncementBanner.jsx index 940aef59fd341..8826c62638ee7 100644 --- a/apps/src/templates/studioHomepages/MarketingAnnouncementBanner.jsx +++ b/apps/src/templates/studioHomepages/MarketingAnnouncementBanner.jsx @@ -3,7 +3,6 @@ import React, {useState, useEffect, useRef, useCallback} from 'react'; import Button from '@cdo/apps/legacySharedComponents/Button'; import {pegasus} from '@cdo/apps/lib/util/urlHelpers'; -import firehoseClient from '@cdo/apps/metrics/firehose'; import {tryGetLocalStorage, trySetLocalStorage} from '@cdo/apps/utils'; import color from '../../util/color'; @@ -61,23 +60,6 @@ const MarketingAnnouncementBanner = ({announcement, marginBottom}) => { const bannerKey = getLocalStorageBannerKey(); trySetLocalStorage(bannerKey, false); setDisplayBanner(false); - logEvent('close_button_clicked'); - }; - - const logEvent = eventLabel => { - firehoseClient.putRecord( - { - study: 'teacher_signedin_homepage', - study_group: 'homepage_banner', - event: eventLabel, - data_json: JSON.stringify({ - banner_title: bannerRef.current.querySelector( - '.two-column-action-block--sub-heading' - ).innerText, - }), - }, - {includeUserId: true} - ); }; // Set displayBanner value if the function to get the storage banner key @@ -98,7 +80,6 @@ const MarketingAnnouncementBanner = ({announcement, marginBottom}) => { : 'marketing-announcement-banner-btn', url: announcement.buttonUrl, text: announcement.buttonText, - onClick: () => logEvent('cta_button_clicked'), }; return ( diff --git a/apps/src/templates/studioHomepages/teacherHomepageV2/JoinLink/JoinLinkCopyButton.tsx b/apps/src/templates/studioHomepages/teacherHomepageV2/JoinLink/JoinLinkCopyButton.tsx index 1ad6412c955d0..a7d1f3b469aee 100644 --- a/apps/src/templates/studioHomepages/teacherHomepageV2/JoinLink/JoinLinkCopyButton.tsx +++ b/apps/src/templates/studioHomepages/teacherHomepageV2/JoinLink/JoinLinkCopyButton.tsx @@ -10,7 +10,6 @@ import React from 'react'; import {EVENTS, PLATFORMS} from '@cdo/apps/metrics/AnalyticsConstants'; import analyticsReporter from '@cdo/apps/metrics/AnalyticsReporter'; -import firehoseClient from '@cdo/apps/metrics/firehose'; import {LOGIN_TYPES_WITH_PASSWORD_COLUMN} from '@cdo/apps/templates/teacherDashboard/LoginTypeConstants'; import copyToClipboard from '@cdo/apps/util/copyToClipboard'; import {SectionLoginType} from '@cdo/generated-scripts/sharedConstants'; @@ -39,17 +38,6 @@ const JoinLinkCopyButton: React.FC = ({ const [showCopiedMsg, setShowCopiedMsg] = React.useState(false); const showSectionCodeDialog = () => { - firehoseClient.putRecord( - { - study: 'teacher-dashboard', - study_group: 'manage-students-actions', - event: 'no-section-code-link', - data_json: JSON.stringify({ - sectionId: sectionId, - }), - }, - {includeUserId: true} - ); setShouldShowDialog(true); }; @@ -61,17 +49,6 @@ const JoinLinkCopyButton: React.FC = ({ const handleCopySectionCode = () => { const joinLink = `${studioUrlPrefix}/join/${sectionCode}`; copyToClipboard(joinLink); - firehoseClient.putRecord( - { - study: 'teacher-dashboard', - study_group: 'manage-students-actions', - event: 'copy-section-code-join-link', - data_json: JSON.stringify({ - sectionId: sectionId, - }), - }, - {includeUserId: true} - ); analyticsReporter.sendEvent( EVENTS.SECTION_CARD_CLASS_CODE_CLICKED, {source: sourceName}, diff --git a/apps/src/templates/tables/QuickActionsCell.jsx b/apps/src/templates/tables/QuickActionsCell.jsx index cc5c7973bccd8..44b2198889821 100644 --- a/apps/src/templates/tables/QuickActionsCell.jsx +++ b/apps/src/templates/tables/QuickActionsCell.jsx @@ -2,7 +2,6 @@ import throttle from 'lodash/debounce'; import PropTypes from 'prop-types'; import React, {Component} from 'react'; -import firehoseClient from '@cdo/apps/metrics/firehose'; import PopUpMenu from '@cdo/apps/sharedComponents/PopUpMenu'; import FontAwesome from '../../legacySharedComponents/FontAwesome'; @@ -55,9 +54,6 @@ export default class QuickActionsCell extends Component { this.updateMenuLocation(); window.addEventListener('resize', throttle(this.updateMenuLocation, 50)); this.setState({open: true, canOpen: false}); - if (this.props.experimentDetails) { - firehoseClient.putRecord(this.props.experimentDetails); - } }; // Menu closed diff --git a/apps/src/templates/teacherDashboard/OwnedSections.jsx b/apps/src/templates/teacherDashboard/OwnedSections.jsx index 811730d06546e..9094d4f38bdf5 100644 --- a/apps/src/templates/teacherDashboard/OwnedSections.jsx +++ b/apps/src/templates/teacherDashboard/OwnedSections.jsx @@ -10,30 +10,12 @@ import LtiFeedbackBanner from '@cdo/apps/simpleSignUp/lti/feedback/LtiFeedbackBa import styleConstants from '@cdo/apps/styleConstants'; import GlobalEditionWrapper from '@cdo/apps/templates/GlobalEditionWrapper'; import color from '@cdo/apps/util/color'; -import experiments from '@cdo/apps/util/experiments'; import i18n from '@cdo/locale'; -import firehoseClient from '../../metrics/firehose'; - -import {recordImpression} from './impressionHelpers'; import OwnedPlSectionsTable from './OwnedPlSectionsTable'; import OwnedSectionsTable from './OwnedSectionsTable'; import {beginEditingSection} from './teacherSectionsRedux'; -const recordOpenEditSectionDetails = (sectionId, studyGroup) => { - firehoseClient.putRecord( - { - study: 'teacher_dashboard_actions', - study_group: studyGroup, - event: 'open_edit_section_dashboard_header', - data_json: JSON.stringify({ - section_id: sectionId, - }), - }, - {includeUserId: true} - ); -}; - class OwnedSections extends React.Component { static propTypes = { isPlSections: PropTypes.bool, @@ -51,26 +33,10 @@ class OwnedSections extends React.Component { constructor(props) { super(props); this.onEditSection = this.onEditSection.bind(this); - if (experiments.isEnabled(experiments.TEACHER_DASHBOARD_SECTION_BUTTONS)) { - recordImpression('owned_sections_table_with_dashboard_header_buttons'); - } else { - recordImpression('owned_sections_table_without_dashboard_header_buttons'); - } } onEditSection(id) { this.props.beginEditingSection(id); - if (experiments.isEnabled(experiments.TEACHER_DASHBOARD_SECTION_BUTTONS)) { - recordOpenEditSectionDetails( - id, - 'owned_sections_table_with_dashboard_header_buttons' - ); - } else { - recordOpenEditSectionDetails( - id, - 'owned_sections_table_without_dashboard_header_buttons' - ); - } } // Wrapped to avoid passing event args diff --git a/apps/src/templates/teacherDashboard/impressionHelpers.js b/apps/src/templates/teacherDashboard/impressionHelpers.js deleted file mode 100644 index da1d5cf7641e4..0000000000000 --- a/apps/src/templates/teacherDashboard/impressionHelpers.js +++ /dev/null @@ -1,10 +0,0 @@ -import firehoseClient from '../../metrics/firehose'; - -export function recordImpression(study_group) { - firehoseClient.putRecord({ - study: 'teacher_dashboard_actions', - study_group: study_group, - event: 'load_feature', - data_json: '{}', - }); -} diff --git a/apps/src/templates/teacherDashboard/teacherSectionsRedux.ts b/apps/src/templates/teacherDashboard/teacherSectionsRedux.ts index 98a1a885a3c2d..f3d55f7b01fdb 100644 --- a/apps/src/templates/teacherDashboard/teacherSectionsRedux.ts +++ b/apps/src/templates/teacherDashboard/teacherSectionsRedux.ts @@ -13,7 +13,6 @@ import DCDO from '@cdo/apps/dcdo'; import {ParticipantAudience} from '@cdo/apps/generated/curriculum/sharedCourseConstants'; import {EVENTS, PLATFORMS} from '@cdo/apps/metrics/AnalyticsConstants'; import analyticsReporter from '@cdo/apps/metrics/AnalyticsReporter'; -import firehoseClient from '@cdo/apps/metrics/firehose'; import {RootState} from '@cdo/apps/types/redux'; import experiments from '@cdo/apps/util/experiments'; import HttpClient from '@cdo/apps/util/HttpClient'; @@ -585,22 +584,6 @@ const sectionSlice = createSlice({ ) .map(section => section.id); - if (section.loginType !== state.initialLoginType) { - firehoseClient.putRecord( - { - study: 'teacher-dashboard', - study_group: 'edit-section-details', - event: 'change-login-type', - data_json: JSON.stringify({ - sectionId: section.id, - initialLoginType: state.initialLoginType, - updatedLoginType: section.loginType, - }), - }, - {includeUserId: true} - ); - } - const assignmentData: AssignmentData = { section_id: section.id, section_creation_timestamp: section.createdAt, @@ -621,18 +604,6 @@ const sectionSlice = createSlice({ if (section.unitName !== state.initialUnitName) { assignmentData.unitName = section.unitName; } - // If either of these has been set, assignment changed and should be logged - if (assignmentData.unit_id || assignmentData.course_id) { - firehoseClient.putRecord( - { - study: 'assignment', - study_group: 'v1', - event: isNewSection ? 'create_section' : 'edit_section_details', - data_json: JSON.stringify(assignmentData), - }, - {includeUserId: true} - ); - } state.sectionBeingEdited = null; state.saveInProgress = false; @@ -767,15 +738,6 @@ export const toggleSectionHidden = const currentlyHidden = state.sections[sectionId].hidden; dispatch(editSectionProperties({hidden: !currentlyHidden})); - // Track archive/restore section action - firehoseClient.putRecord({ - study: 'teacher_dashboard_actions', - study_group: 'toggleSectionHidden', - event: currentlyHidden ? 'restoreSection' : 'archiveSection', - data_json: JSON.stringify({ - section_id: sectionId, - }), - }); return dispatch(finishEditingSection()); }; @@ -1007,23 +969,6 @@ export const assignToSection = ( unitId: number, pageType: string ): SectionThunkAction => { - firehoseClient.putRecord( - { - study: 'assignment', - event: 'course-assigned-to-section', - data_json: JSON.stringify( - { - sectionId, - unitId, - courseId, - date: new Date(), - }, - removeNullValues - ), - }, - {includeUserId: true} - ); - return (dispatch, getState) => { const section = getState().teacherSections.sections[sectionId]; if ( @@ -1081,10 +1026,9 @@ export const assignToSection = ( * @param {number} sectionId */ export const unassignSection = - (sectionId: number, location: string): SectionThunkAction => + (sectionId: number): SectionThunkAction => (dispatch, getState) => { dispatch(beginEditingSection(sectionId, true)); - const {initialCourseId, initialUnitId} = getState().teacherSections; dispatch( editSectionProperties({ @@ -1094,36 +1038,9 @@ export const unassignSection = unitId: null, }) ); - firehoseClient.putRecord( - { - study: 'assignment', - event: 'course-unassigned-from-section', - data_json: JSON.stringify( - { - sectionId, - scriptId: initialUnitId, - courseId: initialCourseId, - location: location, - date: new Date(), - }, - removeNullValues - ), - }, - {includeUserId: true} - ); return dispatch(finishEditingSection()); }; -/** - * Removes null values from stringified object before sending firehose record - */ -function removeNullValues(key: string, val?: string | number | null) { - if (val === null || typeof val === 'undefined') { - return undefined; - } - return val; -} - /** @const {Object} Map oauth section type to relative "list rosters" URL. */ const urlByProvider: {[key: string]: string} = { [OAuthSectionTypes.google_classroom]: '/dashboardapi/google_classrooms', diff --git a/apps/src/templates/teacherDashboardShared/UnitSelectorV2.jsx b/apps/src/templates/teacherDashboardShared/UnitSelectorV2.jsx index 4898eb9216b54..59c765572e5d5 100644 --- a/apps/src/templates/teacherDashboardShared/UnitSelectorV2.jsx +++ b/apps/src/templates/teacherDashboardShared/UnitSelectorV2.jsx @@ -6,7 +6,6 @@ import {connect} from 'react-redux'; import {EVENTS} from '@cdo/apps/metrics/AnalyticsConstants'; import analyticsReporter from '@cdo/apps/metrics/AnalyticsReporter'; -import firehoseClient from '@cdo/apps/metrics/firehose'; import {getStore} from '@cdo/apps/redux'; import { asyncLoadCoursesWithProgress, @@ -20,21 +19,6 @@ import i18n from '@cdo/locale'; import styles from './unit-selector-v2.module.scss'; import skeletonizeContent from '@cdo/apps/sharedComponents/skeletonize-content.module.scss'; -const recordEvent = (eventName, sectionId, dataJson = {}) => { - firehoseClient.putRecord( - { - study: 'teacher_dashboard_actions', - study_group: 'progress_v2', - event: eventName, - data_json: JSON.stringify({ - section_id: sectionId, - ...dataJson, - }), - }, - {includeUserId: true} - ); -}; - function UnitSelectorV2({ filterToSelectedCourse = false, sectionId, @@ -71,11 +55,6 @@ function UnitSelectorV2({ const newUnitPosition = getSelectedUnitPosition(currentState); loadUnitProgress(newUnitId, sectionId, newCourseId, newUnitPosition); - recordEvent('change_script', sectionId, { - old_script_id: unitId, - new_script_id: newUnitId, - }); - analyticsReporter.sendEvent(EVENTS.PROGRESS_V2_CHANGE_UNIT, { sectionId: sectionId, oldUnitId: unitId, From c8fc87c5bda1ae2eceb6b0cedda053e45f6f161c Mon Sep 17 00:00:00 2001 From: alex-m-brown Date: Fri, 19 Dec 2025 11:25:31 -0500 Subject: [PATCH 2/2] fix tests --- .../unit/templates/VersionHistoryTest.jsx | 26 ------------------- .../VersionHistoryWithCommitsDialogTest.jsx | 22 ---------------- .../LessonNavigationDropdownTest.jsx | 5 ---- .../activities/LevelDetailsDialogTest.jsx | 5 ---- .../JoinLink/JoinLinkCopyButtonTest.tsx | 13 ---------- 5 files changed, 71 deletions(-) diff --git a/apps/test/unit/templates/VersionHistoryTest.jsx b/apps/test/unit/templates/VersionHistoryTest.jsx index b40f62d02966b..6405d48c655cc 100644 --- a/apps/test/unit/templates/VersionHistoryTest.jsx +++ b/apps/test/unit/templates/VersionHistoryTest.jsx @@ -3,7 +3,6 @@ import React from 'react'; import {sources as sourcesApi, files as filesApi} from '@cdo/apps/clientApi'; import project from '@cdo/apps/code-studio/initApp/project'; -import firehoseClient from '@cdo/apps/metrics/firehose'; import VersionHistory from '@cdo/apps/templates/VersionHistory'; import VersionRow from '@cdo/apps/templates/VersionRow'; import * as utils from '@cdo/apps/utils'; @@ -260,11 +259,6 @@ describe('VersionHistory', () => { let handleClearPuzzle; beforeEach(() => { - jest - .spyOn(firehoseClient, 'putRecord') - .mockClear() - .mockImplementation(); - handleClearPuzzle = jest.fn().mockReturnValue(Promise.resolve()); wrapper = mount( @@ -276,7 +270,6 @@ describe('VersionHistory', () => { afterEach(async () => { await wasCalled(utils.reload); - firehoseClient.putRecord.mockRestore(); }); it('immediately renders spinner', () => { @@ -287,25 +280,6 @@ describe('VersionHistory', () => { ); }); - it('logs to firehose', () => { - expect(firehoseClient.putRecord).toHaveBeenCalledWith( - { - study: 'project-data-integrity', - study_group: 'v4', - event: 'clear-puzzle', - project_id: 'fake-project-id', - data_json: JSON.stringify({ - isOwner: true, - currentUrl: window.location.href, - shareUrl: 'fake-share-url', - isProjectTemplateLevel: false, - currentSourceVersionId: FAKE_CURRENT_VERSION, - }), - }, - {includeUserId: true} - ); - }); - it('calls handleClearPuzzle prop', () => { expect(handleClearPuzzle).toHaveBeenCalledTimes(1); }); diff --git a/apps/test/unit/templates/VersionHistoryWithCommitsDialogTest.jsx b/apps/test/unit/templates/VersionHistoryWithCommitsDialogTest.jsx index 1994146344d40..5ac6e9f09a7a2 100644 --- a/apps/test/unit/templates/VersionHistoryWithCommitsDialogTest.jsx +++ b/apps/test/unit/templates/VersionHistoryWithCommitsDialogTest.jsx @@ -4,7 +4,6 @@ import sinon from 'sinon'; // eslint-disable-line no-restricted-imports import {sources as sourcesApi} from '@cdo/apps/clientApi'; import project from '@cdo/apps/code-studio/initApp/project'; -import firehoseClient from '@cdo/apps/metrics/firehose'; import VersionHistoryWithCommitsDialog from '@cdo/apps/templates/VersionHistoryWithCommitsDialog'; import * as utils from '@cdo/apps/utils'; @@ -204,7 +203,6 @@ describe('VersionHistoryWithCommitsDialog', () => { let handleClearPuzzle; beforeEach(() => { - sinon.stub(firehoseClient, 'putRecord'); sinon.stub(project, 'getCurrentId').returns('fake-project-id'); sinon .stub(project, 'getCurrentSourceVersionId') @@ -227,7 +225,6 @@ describe('VersionHistoryWithCommitsDialog', () => { afterEach(async () => { await wasCalled(utils.reload); - firehoseClient.putRecord.restore(); project.getCurrentId.restore(); project.getCurrentSourceVersionId.restore(); project.getShareUrl.restore(); @@ -243,25 +240,6 @@ describe('VersionHistoryWithCommitsDialog', () => { ); }); - it('logs to firehose', () => { - expect(firehoseClient.putRecord).to.have.been.calledOnce.and.calledWith( - { - study: 'project-data-integrity', - study_group: 'v4', - event: 'clear-puzzle', - project_id: 'fake-project-id', - data_json: JSON.stringify({ - isOwner: true, - currentUrl: window.location.href, - shareUrl: 'fake-share-url', - isProjectTemplateLevel: false, - currentSourceVersionId: FAKE_CURRENT_VERSION, - }), - }, - {includeUserId: true} - ); - }); - it('calls handleClearPuzzle prop', () => { expect(handleClearPuzzle).to.have.been.calledOnce; }); diff --git a/apps/test/unit/templates/lessonOverview/LessonNavigationDropdownTest.jsx b/apps/test/unit/templates/lessonOverview/LessonNavigationDropdownTest.jsx index 2dff6963725c1..2eb7e5a83070d 100644 --- a/apps/test/unit/templates/lessonOverview/LessonNavigationDropdownTest.jsx +++ b/apps/test/unit/templates/lessonOverview/LessonNavigationDropdownTest.jsx @@ -2,7 +2,6 @@ import {shallow} from 'enzyme'; // eslint-disable-line no-restricted-imports import React from 'react'; import sinon from 'sinon'; // eslint-disable-line no-restricted-imports -import firehoseClient from '@cdo/apps/metrics/firehose'; import DropdownButton from '@cdo/apps/templates/DropdownButton'; import LessonNavigationDropdown from '@cdo/apps/templates/lessonOverview/LessonNavigationDropdown'; import * as utils from '@cdo/apps/utils'; @@ -190,7 +189,6 @@ describe('LessonNavigationDropdown', () => { }); it('navigates when click lesson', () => { - sinon.stub(firehoseClient, 'putRecord'); sinon.stub(utils, 'navigateToHref'); lesson.unit.lessonGroups = twoLessonGroups; @@ -200,10 +198,7 @@ describe('LessonNavigationDropdown', () => { expect(wrapper.find('a').at(1).contains('1 - Lesson 1')).to.be.true; lesson1.simulate('click', {preventDefault: () => {}}); - expect(firehoseClient.putRecord).to.have.been.calledOnce; - firehoseClient.putRecord.yieldTo('callback'); expect(utils.navigateToHref).to.have.been.calledOnce; utils.navigateToHref.restore(); - firehoseClient.putRecord.restore(); }); }); diff --git a/apps/test/unit/templates/lessonOverview/activities/LevelDetailsDialogTest.jsx b/apps/test/unit/templates/lessonOverview/activities/LevelDetailsDialogTest.jsx index c3e313dd43a27..9b9fd07552b56 100644 --- a/apps/test/unit/templates/lessonOverview/activities/LevelDetailsDialogTest.jsx +++ b/apps/test/unit/templates/lessonOverview/activities/LevelDetailsDialogTest.jsx @@ -3,7 +3,6 @@ import React from 'react'; import sinon from 'sinon'; // eslint-disable-line no-restricted-imports import {ViewType} from '@cdo/apps/code-studio/viewAsRedux'; -import firehoseClient from '@cdo/apps/metrics/firehose'; import {UnconnectedLevelDetailsDialog as LevelDetailsDialog} from '@cdo/apps/templates/lessonOverview/activities/LevelDetailsDialog'; import * as utils from '@cdo/apps/utils'; @@ -45,7 +44,6 @@ describe('LevelDetailsDialogTest', () => { }); it('links to level url', () => { - sinon.stub(firehoseClient, 'putRecord'); sinon.stub(utils, 'windowOpen'); const wrapper = shallow( @@ -62,12 +60,9 @@ describe('LevelDetailsDialogTest', () => { ); const levelLink = wrapper.find('Button').at(1); levelLink.simulate('click', {preventDefault: () => {}}); - expect(firehoseClient.putRecord).to.have.been.calledOnce; - firehoseClient.putRecord.yieldTo('callback'); expect(utils.windowOpen).to.have.been.calledWith('level.url?no_redirect=1'); utils.windowOpen.restore(); - firehoseClient.putRecord.restore(); }); it('can display an external markdown level', () => { diff --git a/apps/test/unit/templates/studioHomepages/teacherHomepageV2/JoinLink/JoinLinkCopyButtonTest.tsx b/apps/test/unit/templates/studioHomepages/teacherHomepageV2/JoinLink/JoinLinkCopyButtonTest.tsx index 98e86309bbec2..a4dee28592443 100644 --- a/apps/test/unit/templates/studioHomepages/teacherHomepageV2/JoinLink/JoinLinkCopyButtonTest.tsx +++ b/apps/test/unit/templates/studioHomepages/teacherHomepageV2/JoinLink/JoinLinkCopyButtonTest.tsx @@ -3,13 +3,11 @@ import React from 'react'; import {EVENTS, PLATFORMS} from '@cdo/apps/metrics/AnalyticsConstants'; import analyticsReporter from '@cdo/apps/metrics/AnalyticsReporter'; -import firehoseClient from '@cdo/apps/metrics/firehose'; import JoinLinkCopyButton from '@cdo/apps/templates/studioHomepages/teacherHomepageV2/JoinLink/JoinLinkCopyButton'; import copyToClipboard from '@cdo/apps/util/copyToClipboard'; import {SectionLoginType} from '@cdo/generated-scripts/sharedConstants'; import i18n from '@cdo/locale'; -jest.mock('@cdo/apps/metrics/firehose'); jest.mock('@cdo/apps/metrics/AnalyticsReporter'); jest.mock('@cdo/apps/util/copyToClipboard'); @@ -64,17 +62,6 @@ describe('JoinLinkCopyButton', () => { expect(copyToClipboard).toHaveBeenCalledWith( 'https://studio.code.org/join/ABC123' ); - expect(firehoseClient.putRecord).toHaveBeenCalledWith( - { - study: 'teacher-dashboard', - study_group: 'manage-students-actions', - event: 'copy-section-code-join-link', - data_json: JSON.stringify({ - sectionId: 123, - }), - }, - {includeUserId: true} - ); expect(analyticsReporter.sendEvent).toHaveBeenCalledWith( EVENTS.SECTION_CARD_CLASS_CODE_CLICKED, {source: 'teacherHomepage'},