Skip to content

Commit f6ff519

Browse files
authored
Merge pull request code-dot-org#26950 from code-dot-org/pl-teacher-application-log-users
PL: teacher application logs user to firehose when starting
2 parents 4ebeeb0 + 932499d commit f6ff519

File tree

3 files changed

+29
-2
lines changed

3 files changed

+29
-2
lines changed

apps/src/code-studio/pd/application/teacher1920/Teacher1920Application.jsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ import Section3TeachingBackground from './Section3TeachingBackground';
66
import Section4ProfessionalLearningProgramRequirements from './Section4ProfessionalLearningProgramRequirements';
77
import Section5AdditionalDemographicInformation from './Section5AdditionalDemographicInformation';
88
import Section6Submission from './Section6Submission';
9+
import firehoseClient from "@cdo/apps/lib/util/firehose";
910
/* global ga */
1011

1112
export default class Teacher1920Application extends FormController {
1213
static propTypes = {
1314
...FormController.propTypes,
14-
accountEmail: PropTypes.string.isRequired
15+
accountEmail: PropTypes.string.isRequired,
16+
userId: PropTypes.number.isRequired
1517
};
1618

1719
static submitButtonText = "Complete and Send";
@@ -42,6 +44,21 @@ export default class Teacher1920Application extends FormController {
4244
};
4345
}
4446

47+
/**
48+
* @override
49+
*/
50+
onInitialize() {
51+
// Log the user ID to firehose.
52+
firehoseClient.putRecord(
53+
{
54+
userId: this.props.userId,
55+
study: 'application-funnel',
56+
event: 'started-teacher1920-application'
57+
},
58+
{includeUserId: false}
59+
);
60+
}
61+
4562
/**
4663
* @override
4764
*/

apps/src/code-studio/pd/form_components/FormController.jsx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ export default class FormController extends React.Component {
4949
this.handleSubmit = this.handleSubmit.bind(this);
5050
this.nextPage = this.nextPage.bind(this);
5151
this.prevPage = this.prevPage.bind(this);
52+
53+
this.onInitialize();
5254
}
5355

5456
componentWillMount() {
@@ -167,6 +169,13 @@ export default class FormController extends React.Component {
167169
};
168170
}
169171

172+
/**
173+
* Called when we initialize the form.
174+
*/
175+
onInitialize() {
176+
// Intentional noop; overridden by child classes
177+
}
178+
170179
/**
171180
* Called when we get a successful response from the API submission
172181
*/

dashboard/app/controllers/pd/application/teacher_application_controller.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ def new
2323
options: TEACHER_APPLICATION_CLASS.options.camelize_keys,
2424
requiredFields: TEACHER_APPLICATION_CLASS.camelize_required_fields,
2525
accountEmail: current_user.email,
26-
apiEndpoint: '/api/v1/pd/application/teacher'
26+
apiEndpoint: '/api/v1/pd/application/teacher',
27+
userId: current_user.id
2728
}.to_json
2829
}
2930
end

0 commit comments

Comments
 (0)