From 07ad54bb6ccb1e243d2cf45c98f9eb09746fdf0e Mon Sep 17 00:00:00 2001 From: Paul Kaplan Date: Wed, 2 Jan 2019 16:19:26 -0500 Subject: [PATCH] Only track green flag once --- src/views/preview/project-view.jsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/views/preview/project-view.jsx b/src/views/preview/project-view.jsx index e2eaff047..5492d9da0 100644 --- a/src/views/preview/project-view.jsx +++ b/src/views/preview/project-view.jsx @@ -117,7 +117,8 @@ class Preview extends React.Component { showUsernameBlockAlert: false, projectId: parts[1] === 'editor' ? '0' : parts[1], reportOpen: false, - singleCommentId: singleCommentId + singleCommentId: singleCommentId, + greenFlagRecorded: false }; /* In the beginning, if user is on mobile and landscape, go to fullscreen */ this.setScreenFromOrientation(); @@ -357,11 +358,14 @@ class Preview extends React.Component { this.props.reportProject(this.state.projectId, formData, this.props.user.token); } handleGreenFlag () { + if (!this.state.greenFlagRecorded) { + this.props.logProjectView(this.props.projectInfo.id, this.props.authorUsername, this.props.user.token); + } this.setState({ showUsernameBlockAlert: false, - showCloudDataAlert: false + showCloudDataAlert: false, + greenFlagRecorded: true }); - this.props.logProjectView(this.props.projectInfo.id, this.props.authorUsername, this.props.user.token); } handlePopState () { const path = window.location.pathname.toLowerCase();