Merge pull request #129 from edx/andytr1/analytics-move-events-from-frontend-and-add-courseid
EDUCATOR-4715 working on moving analytics events to redux
This commit is contained in:
@@ -13,7 +13,6 @@ import {
|
||||
Table,
|
||||
Tabs,
|
||||
} from '@edx/paragon';
|
||||
import { trackEvent } from '@redux-beacon/segment';
|
||||
import queryString from 'query-string';
|
||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||
import { faDownload, faSpinner, faFilter } from '@fortawesome/free-solid-svg-icons';
|
||||
@@ -21,7 +20,6 @@ import { configuration } from '../../config';
|
||||
import PageButtons from '../PageButtons';
|
||||
import Drawer from '../Drawer';
|
||||
import { formatDateForDisplay } from '../../data/actions/utils';
|
||||
import { trackingCategory } from '../../data/store';
|
||||
|
||||
|
||||
const DECIMAL_PRECISION = 2;
|
||||
@@ -305,24 +303,12 @@ export default class Gradebook extends React.Component {
|
||||
// The following properties of a google analytics event are:
|
||||
// category (used), name(used), lavel(not used), value(not used)
|
||||
handleClickExportGrades = () => {
|
||||
trackEvent(() => ({
|
||||
name: 'edx.gradebook.reports.grade_export.downloaded',
|
||||
properties: {
|
||||
category: trackingCategory,
|
||||
label: this.props.courseId,
|
||||
},
|
||||
}));
|
||||
this.props.downloadBulkGradesReport(this.props.courseId);
|
||||
window.location = this.props.gradeExportUrl;
|
||||
};
|
||||
|
||||
handleClickDownloadInterventions = () => {
|
||||
trackEvent(() => ({
|
||||
name: 'edx.gradebook.reports.intervention.downloaded',
|
||||
properties: {
|
||||
category: trackingCategory,
|
||||
label: this.props.courseId,
|
||||
},
|
||||
}));
|
||||
this.props.downloadInterventionReport(this.props.courseId);
|
||||
window.location = this.props.interventionExportUrl;
|
||||
};
|
||||
|
||||
@@ -508,6 +494,7 @@ export default class Gradebook extends React.Component {
|
||||
this.props.updateCourseGradeFilter(
|
||||
courseGradeMin,
|
||||
courseGradeMax,
|
||||
this.props.courseId,
|
||||
);
|
||||
this.props.getUserGrades(
|
||||
this.props.courseId,
|
||||
@@ -520,19 +507,6 @@ export default class Gradebook extends React.Component {
|
||||
},
|
||||
);
|
||||
this.updateQueryParams({ courseGradeMin, courseGradeMax });
|
||||
trackEvent(() => ({
|
||||
name: 'edx.gradebook.grades.filter_applied',
|
||||
properties: {
|
||||
category: trackingCategory,
|
||||
label: this.props.courseId,
|
||||
cohort: this.props.selectedCohort,
|
||||
track: this.props.selectedTrack,
|
||||
assignmentType: this.props.selectedAssignmentType,
|
||||
gradeMin: courseGradeMin,
|
||||
gradeMax: courseGradeMax,
|
||||
|
||||
},
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1059,4 +1033,6 @@ Gradebook.propTypes = {
|
||||
initializeFilters: PropTypes.func.isRequired,
|
||||
updateGradesIfAssignmentGradeFiltersSet: PropTypes.func.isRequired,
|
||||
updateCourseGradeFilter: PropTypes.func.isRequired,
|
||||
downloadBulkGradesReport: PropTypes.func.isRequired,
|
||||
downloadInterventionReport: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
@@ -13,6 +13,8 @@ import {
|
||||
toggleGradeFormat,
|
||||
updateGrades,
|
||||
updateGradesIfAssignmentGradeFiltersSet,
|
||||
downloadBulkGradesReport,
|
||||
downloadInterventionReport,
|
||||
} from '../../data/actions/grades';
|
||||
import { fetchCohorts } from '../../data/actions/cohorts';
|
||||
import { fetchTracks } from '../../data/actions/tracks';
|
||||
@@ -135,6 +137,8 @@ const mapDispatchToProps = {
|
||||
updateAssignmentLimits,
|
||||
updateGradesIfAssignmentGradeFiltersSet,
|
||||
updateCourseGradeFilter,
|
||||
downloadBulkGradesReport,
|
||||
downloadInterventionReport,
|
||||
};
|
||||
|
||||
const GradebookPage = connect(
|
||||
|
||||
@@ -33,11 +33,12 @@ const updateAssignmentLimits = (minGrade, maxGrade) => ({
|
||||
data: { minGrade, maxGrade },
|
||||
});
|
||||
|
||||
const updateCourseGradeFilter = (courseGradeMin, courseGradeMax) => ({
|
||||
const updateCourseGradeFilter = (courseGradeMin, courseGradeMax, courseId) => ({
|
||||
type: UPDATE_COURSE_GRADE_LIMITS,
|
||||
data: {
|
||||
courseGradeMin,
|
||||
courseGradeMax,
|
||||
courseId,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@ import {
|
||||
ERROR_FETCHING_GRADE_OVERRIDE_HISTORY,
|
||||
UPLOAD_OVERRIDE,
|
||||
UPLOAD_OVERRIDE_ERROR,
|
||||
BULK_GRADE_REPORT_DOWNLOADED,
|
||||
INTERVENTION_REPORT_DOWNLOADED,
|
||||
} from '../constants/actionTypes/grades';
|
||||
import LmsApiService from '../services/LmsApiService';
|
||||
import { sortAlphaAsc, formatDateForDisplay } from './utils';
|
||||
@@ -90,6 +92,14 @@ const uploadOverrideSuccess = courseId => ({
|
||||
type: UPLOAD_OVERRIDE,
|
||||
courseId,
|
||||
});
|
||||
const downloadBulkGradesReport = courseId => ({
|
||||
type: BULK_GRADE_REPORT_DOWNLOADED,
|
||||
courseId,
|
||||
});
|
||||
const downloadInterventionReport = courseId => ({
|
||||
type: INTERVENTION_REPORT_DOWNLOADED,
|
||||
courseId,
|
||||
});
|
||||
const uploadOverrideFailure = (courseId, error) => ({
|
||||
type: UPLOAD_OVERRIDE_ERROR,
|
||||
courseId,
|
||||
@@ -326,4 +336,6 @@ export {
|
||||
doneViewingAssignment,
|
||||
fetchGradeOverrideHistory,
|
||||
updateGradesIfAssignmentGradeFiltersSet,
|
||||
downloadBulkGradesReport,
|
||||
downloadInterventionReport,
|
||||
};
|
||||
|
||||
@@ -6,9 +6,10 @@ import { createMiddleware } from 'redux-beacon';
|
||||
import Segment, { trackEvent, trackPageView } from '@redux-beacon/segment';
|
||||
import { GOT_ROLES } from './constants/actionTypes/roles';
|
||||
import {
|
||||
GOT_GRADES, GRADE_UPDATE_SUCCESS, GRADE_UPDATE_FAILURE,
|
||||
UPLOAD_OVERRIDE, UPLOAD_OVERRIDE_ERROR,
|
||||
GOT_GRADES, GRADE_UPDATE_SUCCESS, GRADE_UPDATE_FAILURE, UPLOAD_OVERRIDE,
|
||||
UPLOAD_OVERRIDE_ERROR, BULK_GRADE_REPORT_DOWNLOADED, INTERVENTION_REPORT_DOWNLOADED,
|
||||
} from './constants/actionTypes/grades';
|
||||
import { UPDATE_COURSE_GRADE_LIMITS } from './constants/actionTypes/filters';
|
||||
|
||||
import reducers from './reducers';
|
||||
|
||||
@@ -63,6 +64,28 @@ const eventsMap = {
|
||||
error: action.payload.error,
|
||||
},
|
||||
})),
|
||||
[UPDATE_COURSE_GRADE_LIMITS]: trackEvent(action => ({
|
||||
name: 'edx.gradebook.grades.filter_applied',
|
||||
label: action.courseId,
|
||||
properties: {
|
||||
category: trackingCategory,
|
||||
courseId: action.courseId,
|
||||
},
|
||||
})),
|
||||
[BULK_GRADE_REPORT_DOWNLOADED]: trackEvent(action => ({
|
||||
name: 'edx.gradebook.reports.grade_export.downloaded',
|
||||
properties: {
|
||||
category: trackingCategory,
|
||||
courseId: action.courseId,
|
||||
},
|
||||
})),
|
||||
[INTERVENTION_REPORT_DOWNLOADED]: trackEvent(action => ({
|
||||
name: 'edx.gradebook.reports.intervention.downloaded',
|
||||
properties: {
|
||||
category: trackingCategory,
|
||||
courseId: action.courseId,
|
||||
},
|
||||
})),
|
||||
};
|
||||
|
||||
const segmentMiddleware = createMiddleware(eventsMap, Segment());
|
||||
|
||||
Reference in New Issue
Block a user