Skip to content

Commit

Permalink
Merge pull request #19839 from code-dot-org/staging
Browse files Browse the repository at this point in the history
DTT (Staging > Test) [robo-dtt]
  • Loading branch information
deploy-code-org committed Jan 8, 2018
2 parents ef9e422 + ababa79 commit 3e100eb
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ export default class Section4SummerWorkshop extends ApplicationFormComponent {
// Update state with all the partner workshop data to display
this.setState({
loadingPartner: false,
partnerWorkshops: data.workshops
partnerWorkshops: data.workshops,
regionalPartnerName: data.name
});
});
}
Expand All @@ -89,10 +90,14 @@ export default class Section4SummerWorkshop extends ApplicationFormComponent {
dataType: 'json'
}).done(data => {
this.loadAlternateWorkshopsRequest = null;

const alternateWorkshops = data.reduce((workshops, partner) => (
partner.id !== this.props.data.regionalPartnerId
? workshops.concat(partner.workshops)
: workshops
partner.id === this.props.data.regionalPartnerId
? workshops
: workshops.concat(
// Add partner name to each alternate workshop
partner.workshops.map(w => ({...w, partnerName: partner.name}))
)
), []);

this.setState({
Expand Down Expand Up @@ -182,40 +187,57 @@ export default class Section4SummerWorkshop extends ApplicationFormComponent {
More details will be provided if you are accepted into the program.
</h5>
);
} else if (this.state.partnerWorkshops.length === 1) {
return (
<div>
<h5>
Your region’s assigned summer workshop will be
{` ${this.state.partnerWorkshops[0].dates} in`}
{` ${this.state.partnerWorkshops[0].location}.`}
</h5>

{this.renderAbleToAttendSingle()}
</div>
);
} else { // multiple workshops
const options = this.state.partnerWorkshops.map(workshop =>
`${workshop.dates} in ${workshop.location}`
);
options.push(NO_EXPLAIN);
const textFieldMap = {[NO_EXPLAIN]: 'explain'};
return this.dynamicCheckBoxesWithAdditionalTextFieldsFor(
"ableToAttendMultiple",
options,
textFieldMap
);
} else {
return this.renderPartnerWorkshops();
}
}
}

renderPartnerWorkshops() {
let contents;
if (this.state.partnerWorkshops.length === 1) {
contents = (
<div>
<h5>
Your region’s assigned summer workshop will be
{` ${this.state.partnerWorkshops[0].dates} in`}
{` ${this.state.partnerWorkshops[0].location} `}
hosted by {` ${this.state.regionalPartnerName}.`}
</h5>

{this.renderAbleToAttendSingle()}
</div>
);
} else { // multiple workshops
const options = this.state.partnerWorkshops.map(workshop =>
`${workshop.dates} in ${workshop.location} hosted by ${this.state.regionalPartnerName}`
);
options.push(NO_EXPLAIN);
const textFieldMap = {[NO_EXPLAIN]: 'explain'};
contents = this.dynamicCheckBoxesWithAdditionalTextFieldsFor(
"ableToAttendMultiple",
options,
textFieldMap
);
}

return (
<div>
<h4>
Your regional partner is {this.state.regionalPartnerName}
</h4>
{contents}
</div>
);
}

renderAlternateWorkshopList() {
if (this.state.loadingAlternateWorkshops || this.state.alternateWorkshops === null) {
return null;
}

const options = this.state.alternateWorkshops.map(workshop =>
`${workshop.dates} in ${workshop.location}`
`${workshop.dates} in ${workshop.location} hosted by ${workshop.partnerName}`
);

return this.dynamicCheckBoxesFor("alternateWorkshops", options, {required: false});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ const alternateWorkshops = [
{id: 202, dates: 'February 12-16, 2018', location: 'Seattle, WA'}
];

const alternateWorkshopsWithPartnerName = alternateWorkshops.map(w => ({...w, partnerName: 'Other Partner'}));

const exampleTeachercon = {city: 'Atlanta', dates: 'June 17 - 22, 2018'};

describe("Section4SummerWorkshop", () => {
Expand Down Expand Up @@ -173,9 +175,11 @@ describe("Section4SummerWorkshop", () => {

const allWorkshopsData = [{
id: 100, // Same partner (meaning same single workshop): excluded
name: 'Assigned Partner',
workshops: [assignedWorkshops[0]]
}, {
id: 101, // Different partner: included
name: 'Other Partner',
workshops: alternateWorkshops
}];

Expand All @@ -193,7 +197,7 @@ describe("Section4SummerWorkshop", () => {
server.respond();

expect(section4.state().loadingAlternateWorkshops).to.be.false;
expect(section4.state().alternateWorkshops).to.eql(alternateWorkshops);
expect(section4.state().alternateWorkshops).to.eql(alternateWorkshopsWithPartnerName);
});

it("Does not initially load alternate workshops when able to attend", () => {
Expand Down Expand Up @@ -232,7 +236,7 @@ describe("Section4SummerWorkshop", () => {
server.respond();

expect(section4.state().loadingAlternateWorkshops).to.be.false;
expect(section4.state().alternateWorkshops).to.eql(alternateWorkshops);
expect(section4.state().alternateWorkshops).to.eql(alternateWorkshopsWithPartnerName);
});

it("Does not load alternate workshops when yes is selected", () => {
Expand All @@ -255,9 +259,11 @@ describe("Section4SummerWorkshop", () => {

const allWorkshopsData = [{
id: 200, // Same partner (meaning same assigned workshops): excluded
name: 'Assigned Partner',
workshops: assignedWorkshops
}, {
id: 201, // Different partner: included
name: 'Other Partner',
workshops: alternateWorkshops
}];

Expand All @@ -275,7 +281,7 @@ describe("Section4SummerWorkshop", () => {
server.respond();

expect(section4.state().loadingAlternateWorkshops).to.be.false;
expect(section4.state().alternateWorkshops).to.eql(alternateWorkshops);
expect(section4.state().alternateWorkshops).to.eql(alternateWorkshopsWithPartnerName);
});

it("Does not initially load alternate workshops when able to attend", () => {
Expand Down Expand Up @@ -314,7 +320,7 @@ describe("Section4SummerWorkshop", () => {
server.respond();

expect(section4.state().loadingAlternateWorkshops).to.be.false;
expect(section4.state().alternateWorkshops).to.eql(alternateWorkshops);
expect(section4.state().alternateWorkshops).to.eql(alternateWorkshopsWithPartnerName);
});

it("Does not load alternate workshops when yes is selected", () => {
Expand Down
20 changes: 8 additions & 12 deletions apps/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5851,18 +5851,18 @@ longest@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097"

loose-envify@^1.0.0, loose-envify@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848"
dependencies:
js-tokens "^3.0.0"

loose-envify@^1.1.0, loose-envify@^1.2.0, loose-envify@^1.3.0:
loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.2.0, loose-envify@^1.3.0:
version "1.3.0"
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.0.tgz#6b26248c42f6d4fa4b0d8542f78edfcde35642a8"
dependencies:
js-tokens "^2.0.0"

loose-envify@^1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848"
dependencies:
js-tokens "^3.0.0"

loud-rejection@^1.0.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/loud-rejection/-/loud-rejection-1.6.0.tgz#5b46f80147edee578870f086d04821cf998e551f"
Expand Down Expand Up @@ -9468,18 +9468,14 @@ utils-merge@1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/utils-merge/-/utils-merge-1.0.0.tgz#0294fb922bb9375153541c4f7096231f287c8af8"

uuid@3.0.0:
uuid@3.0.0, uuid@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.0.0.tgz#6728fc0459c450d796a99c31837569bdf672d728"

uuid@^2.0.1, uuid@^2.0.2, uuid@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-2.0.3.tgz#67e2e863797215530dff318e5bf9dcebfd47b21a"

uuid@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.1.0.tgz#3dd3d3e790abc24d7b0d3a034ffababe28ebbc04"

v8flags@^2.0.2:
version "2.0.11"
resolved "https://registry.yarnpkg.com/v8flags/-/v8flags-2.0.11.tgz#bca8f30f0d6d60612cc2c00641e6962d42ae6881"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def set_type_and_year
belongs_to :teacher_application, class_name: 'Pd::Application::Teacher1819Application',
primary_key: :application_guid, foreign_key: :application_guid

DONT_KNOW_EXPLAIN = "I don't know (please explain):"
def self.options
{
title: COMMON_OPTIONS[:title],
Expand All @@ -56,7 +57,7 @@ def self.options
replace_course: [
YES,
"No, this course will be added to the schedule, but it won't replace an existing computer science course",
"I don't know (please explain):"
DONT_KNOW_EXPLAIN
],
replace_which_course_csp: [
'Beauty and Joy of Computing',
Expand Down Expand Up @@ -141,9 +142,12 @@ def dynamic_required_fields(hash)

def additional_text_fields
[
[:do_you_approve],
[:committed_to_master_schedule],
[:committed_to_diversity]
[:replace_course, DONT_KNOW_EXPLAIN, :replace_course_other],
[:committed_to_diversity, OTHER_PLEASE_EXPLAIN, :committed_to_diversity_other],
[:replace_which_course_csd, OTHER_PLEASE_EXPLAIN, :replace_which_course_csd_other],
[:replace_which_course_csp, OTHER_PLEASE_EXPLAIN, :replace_which_course_csp_other],
[:do_you_approve]
]
end

Expand Down
28 changes: 26 additions & 2 deletions dashboard/app/models/pd/application/teacher1819_application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,10 @@ def enroll_user
OTHER_PLEASE_LIST
]

NOT_TEACHING_THIS_YEAR = "I'm not teaching this year (please explain):"
DONT_KNOW_IF_I_WILL_TEACH_EXPLAIN = "I don't know if I will teach this course (please explain):"
UNABLE_TO_ATTEND = "No, I'm unable to attend (please explain):"
NO_EXPLAIN = "No (please explain):"
def self.options
{
country: [
Expand Down Expand Up @@ -164,7 +168,7 @@ def self.options
grades_at_school: GRADES,
grades_teaching: [
*GRADES,
"I'm not teaching this year (please explain):"
NOT_TEACHING_THIS_YEAR
],
grades_expect_to_teach: GRADES,

Expand Down Expand Up @@ -315,7 +319,7 @@ def self.options
plan_to_teach: [
'Yes, I plan to teach this course',
'No, someone else from my school will teach this course',
"I don't know if I will teach this course (please explain):"
DONT_KNOW_IF_I_WILL_TEACH_EXPLAIN
],

pay_fee: [
Expand Down Expand Up @@ -598,6 +602,26 @@ def self.filtered_labels(course)
ALL_LABELS_WITH_OVERRIDES.except(*labels_to_remove)
end

# @override
# Include additional text for all the multi-select fields that have the option
def additional_text_fields
[
[:current_role, OTHER_PLEASE_LIST],
[:grades_teaching, NOT_TEACHING_THIS_YEAR, :grades_teaching_not_teaching_explanation],
[:subjects_teaching, OTHER_PLEASE_LIST],
[:subjects_expect_to_teach, OTHER_PLEASE_LIST],
[:subjects_licensed_to_teach, OTHER_PLEASE_LIST],
[:taught_in_past, OTHER_PLEASE_LIST],
[:cs_offered_at_school, OTHER_PLEASE_LIST],
[:cs_opportunities_at_school, OTHER_PLEASE_LIST],
[:csd_course_hours_per_week, OTHER_PLEASE_LIST],
[:plan_to_teach, DONT_KNOW_IF_I_WILL_TEACH_EXPLAIN, :plan_to_teach_dont_know_explain],
[:able_to_attend_single, UNABLE_TO_ATTEND, :able_to_attend_single_explain],
[:able_to_attend_multiple, NO_EXPLAIN, :able_to_attend_multiple_explain],
[:committed, NO_EXPLAIN, :committed_explain]
]
end

protected

def yes_no_response_to_yes_no_score(response)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def self.clean_multiline(string)
committed_to_master_schedule: 'Are you committed to including this program on the master schedule in 2018-19 if this teacher is accepted into the program. Note: the program may be listed under a different course name as determined by your district.',
hours_per_year: 'Approximately how many course hours per school year will your school offer this course?',
terms_per_year: 'How many terms will this course span in one school year?',
replace_course: 'Will this course replace an existing computer science course in the master schedule? If yes, please list the course(s) that will be replaced.',
replace_course: 'Will this course replace an existing computer science course in the master schedule? If yes, please list the course(s) tha t will be replaced.',
replace_which_course_csp: 'Which existing course or curriculum will CS Principles replace? Mark all that apply.',
replace_which_course_csd: 'Which existing course or curriculum will CS Discoveries replace? Mark all that apply.',
committed_to_diversity: 'Do you commit to recruiting and enrolling a diverse group of students in this course, representative of the overall demographics of your school?',
Expand Down

0 comments on commit 3e100eb

Please sign in to comment.