Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update circuit playground discount code applications for 2020 #32179

Merged
merged 35 commits into from Dec 21, 2019
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
b127918
Set high needs bar to 50%
bencodeorg Nov 12, 2019
8efab7e
Merge branch 'staging' into update-circuit-playground-discount-codes
bencodeorg Nov 19, 2019
21413d9
Non-i18n String changes for 19-20 Adafruit discount codes
bencodeorg Nov 25, 2019
4880ad5
More i18n updates for Adafruit discount codes
bencodeorg Nov 25, 2019
310e549
Add option for discount code with shipping to Alaska and Hawaii
bencodeorg Nov 25, 2019
3cc3cd3
Correct logic for discount codes with and without shipping
bencodeorg Nov 25, 2019
8e8fdba
Check for teacher attendance at Q4 workshop
bencodeorg Nov 27, 2019
21e19ac
Model changes to check for Q4 workshop attendance for discount code e…
bencodeorg Nov 27, 2019
26d49b4
Check Unit 6 intention appropriately
bencodeorg Dec 3, 2019
278ebd3
Consistent variable naming in discount application model
bencodeorg Dec 3, 2019
0c9ea08
Make long string prettier
bencodeorg Dec 3, 2019
6c0535d
Update tests to cover 2020 discount code application requirements
bencodeorg Dec 3, 2019
0402a4d
Update storybook components for 2020 discount codes
bencodeorg Dec 3, 2019
8e8e0e2
Update apps tests
bencodeorg Dec 3, 2019
411d349
More apps test updates for 2020 discount codes
bencodeorg Dec 4, 2019
7d03566
Update discount logic apps test
bencodeorg Dec 4, 2019
a2b4791
Fix more dashboard discount code tests
bencodeorg Dec 5, 2019
1d89206
Fix school tests to account for new high needs bar
bencodeorg Dec 5, 2019
de64b40
Fix enum in circuit playground discount application
bencodeorg Dec 6, 2019
c2d691d
Attendance at virtual workshop 8 counts for discount eligibility
bencodeorg Dec 9, 2019
92d8727
Add string to alert AK/HI teachers about shipping
bencodeorg Dec 11, 2019
3a8e9e6
Separate discount code type from school eligibility
bencodeorg Dec 13, 2019
2f858df
Give full discount to teachers in Alaska and Hawaii
bencodeorg Dec 13, 2019
e573d65
Remove unnecessary new language about AK/HI
bencodeorg Dec 13, 2019
3568e5c
Keep old options in enum for Unit 6 intention responses
bencodeorg Dec 14, 2019
ef1c2ea
Use refute instead of assert_equal for false test
bencodeorg Dec 17, 2019
b55117b
Require workshop subject when checking PD eligibility
bencodeorg Dec 18, 2019
58d0f22
String update for 2020
bencodeorg Dec 18, 2019
68fbb17
Merge branch 'staging' into update-circuit-playground-discount-codes
bencodeorg Dec 19, 2019
9a40301
Pull commit made via GitHub UI
bencodeorg Dec 19, 2019
a7d307b
Add documentation to check on PD attendance method
bencodeorg Dec 19, 2019
0b53924
Update storybooks and JS unit tests
bencodeorg Dec 19, 2019
1c4d7a5
Update factories and tests for maker controller updates
bencodeorg Dec 20, 2019
0098b70
Allow application status check for application with no school
bencodeorg Dec 20, 2019
582465b
Merge staging
bencodeorg Dec 20, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 9 additions & 10 deletions apps/i18n/common/en_us.json
Expand Up @@ -562,22 +562,21 @@
"editSectionDetails": "Edit Section Details",
"editable": "Editable",
"eligibilityExplanation": "In order to be eligible to receive a code for a subsidized Circuit Playground kit, you must meet the following requirements:",
"eligibilityReqPD": "You attended a 5-day summer workshop for CS Discoveries in 2018 or are participating in the 2018-19 Facilitator Development Program as a new CS Discoveries facilitator.",
"eligibilityReqPDFail": "We did not find the email address associated with this account under the list of people who attended CS Discoveries TeacherCon 2017, or in our list of CS Discoveries facilitators and piloters. If you meet the above requirements, please email us at teacher@code.org.",
"eligibilityReqPD": "You attended a 5-day summer workshop for CS Discoveries in 2019 or are participating in the 2019-20 Facilitator Development Program as a new CS Discoveries facilitator.",
"eligibilityReqAcademicYearPD": "You have attended the fourth academic year workshop in the 2019-20 school year or are participating in the 2019-20 Facilitator Development Program as a new CS Discoveries facilitator.",
"eligibilityReqStudentCount": "Ten students in one of your sections have completed the first three units of CS Discoveries.",
"eligibilityReqStudentCountFail": "Sorry, it doesn't look like you have enough students in your sections that have made progress in Units 2 and 3. Please check back here once your students have finished the first semester of CS Discoveries. If you are using a different account to track the progress of students or if you think there has been an error in detecting how much progress your students have made in Units 2 and 3, please contact us at teacher@code.org.",
"eligibilityReqYear": "You plan to teach Unit 6 by the end of the 2019-20 school year.",
"eligibilityReqYear": "You plan to teach Unit 6 by the end of the 2020-21 school year.",
"eligibilityReqYearConfirmInstructions": "Please confirm that you will be teaching Unit 6 of CS Discoveries with your students and when you will be teaching it:",
"eligibilityReqYearFail": "The subsidy for classroom kits of the Adafruit Circuit Playground is available thanks to the generosity of Code.org's donors such as Microsoft, Facebook, Infosys Foundation, Omidyar Network, and Google. Additionally, Adafruit and DHL are helping to lower the cost of these kits directly. Our intention is that these subsidized kits are going to teachers who are teaching all units of CS Discoveries to their students (whether over 1 or 2 years), as we want to lower the barrier to teaching a hardware-based unit.",
"eligibilityRequirements": "Eligibility Requirements",
"eligibilitySchoolUnknown": "Because your school isn't listed, we were not able to look up the data on what percent of your students are eligible for free/reduced-price lunches.",
"eligibilityYearAfter": "I do not plan on teaching it until after the '19-'20 school year.",
"eligibilityYearDecline": "Unfortunately, we can only offer codes for subsidized kits for teachers who know they will be teaching Unit 6 of CS Discoveries by the '19-'20 school year. For any questions or concerns, please contact us at teacher@code.org.",
"eligibilityYearDecline": "Unfortunately, we can only offer codes for subsidized kits for teachers who know they will be teaching Unit 6 of CS Discoveries by the '20-'21 school year. For any questions or concerns, please contact us at teacher@code.org.",
"eligibilityYearNo": "No, I am not planning on teaching Unit 6 of CS Discoveries.",
"eligibilityYearUnknown": "I am not sure.",
"eligibilityYearYes1718": "Yes, I plan on teaching it during the '17-'18 school year.",
"eligibilityYearYes1819": "Yes, I plan on teaching it during the '18-'19 school year.",
"eligibilityYearYes1920": "Yes, I plan on teaching it during the '19-'20 school year.",
"eligibilityYearYesSpring2020": "Yes, I plan on teaching it during spring 2020.",
"eligibilityYearYesFall2020": "Yes, I plan on teaching it during fall 2020.",
"eligibilityYearYesSpring2021": "Yes, I plan on teaching it during spring 2021.",
"emailConfirmationText": "You must confirm the email address you use to sign into this account before we can convert your account to a teacher account.",
"emailConfirmationTitle": "Please confirm your email",
"emailAddressPolicy": "Code.org will not store student email addresses in a retrievable format, for privacy reasons.",
Expand Down Expand Up @@ -1492,10 +1491,10 @@
"verifiedResourcesDetails": "This course provides extra resources which are only available to verified teachers.",
"verifiedResourcesNotice": "Accessing locked lessons and answer keys",
"verifyStatementsforCode": "Please verify the following statements before you can receive a code.",
"verifySignature": "By signing below you commit to teach the second semester of CS Discoveries, including Unit 6, by the '19-'20 school year.",
"verifySignature": "By signing below you commit to teach the second semester of CS Discoveries, including Unit 6, by the '20-'21 school year.",
"verifySingleCode": "I have not received or used another discount code from Code.org to purchase a Circuit Playground kit.",
"verifyStudentCount": "I taught Units 1, 2, and 3 of Code.org's CS Discoveries curriculum to a classroom of at least 10 students.",
"verifyYear": "I plan on teaching Unit 6 (Physical Computing) of CS Discoveries to a classroom of at least 10 students by the end of the '19-'20 school year.",
"verifyYear": "I plan on teaching Unit 6 (Physical Computing) of CS Discoveries to a classroom of at least 10 students by the end of the '20-'21 school year.",
"version": "Version",
"video": "Video",
"videos": "Videos",
Expand Down
30 changes: 25 additions & 5 deletions apps/src/lib/kits/maker/ui/DiscountAdminOverride.jsx
Expand Up @@ -31,6 +31,7 @@ export default class DiscountAdminOverride extends Component {
submitting: false,
teacherID: '',
statusPD: Status.UNKNOWN,
statusAcademicYearPD: Status.UNKNOWN,
statusStudentCount: Status.UNKNOWN,
statusYear: Status.UNKNOWN,
unit6Intention: '',
Expand Down Expand Up @@ -77,6 +78,9 @@ export default class DiscountAdminOverride extends Component {
teacherID,
submitting: false,
statusPD: application.is_pd_eligible ? Status.SUCCEEDED : Status.FAILED,
statusAcademicYearPD: application.is_quarterly_workshop_pd_eligible
? Status.SUCCEEDED
: Status.FAILED,
statusStudentCount: application.is_progress_eligible
? Status.SUCCEEDED
: Status.FAILED,
Expand All @@ -88,8 +92,8 @@ export default class DiscountAdminOverride extends Component {
applicationSchool: application.application_school,
adminOverride: application.admin_set_status
? application.full_discount
? 'Full Discount'
: 'Partial Discount'
? 'Full Discount (with AK/HI shipping)'
: 'Full Discount (without AK/HI shipping)'
: 'None',
fullDiscount: application.full_discount,
discountCode: application.discount_code,
Expand Down Expand Up @@ -155,6 +159,10 @@ export default class DiscountAdminOverride extends Component {
stepName={i18n.eligibilityReqPD()}
stepStatus={this.state.statusPD}
/>
<ValidationStep
stepName={i18n.eligibilityReqAcademicYearPD()}
stepStatus={this.state.statusAcademicYearPD}
/>
<ValidationStep
stepName={i18n.eligibilityReqStudentCount()}
stepStatus={this.state.statusStudentCount}
Expand Down Expand Up @@ -221,7 +229,7 @@ export default class DiscountAdminOverride extends Component {
<a href="https://studio.code.org/admin/studio_person">
Studio Person ID admin page{' '}
</a>{' '}
to link this acccount to the account associated with the email
to link this account to the account associated with the email
address we have on file.
</div>
<h4>Option 2: Give teacher a discount code</h4>
Expand All @@ -237,6 +245,18 @@ export default class DiscountAdminOverride extends Component {
code to purchase a kit.
</div>
<div style={styles.radioContainer}>
<label>
<input
style={styles.radio}
type="radio"
name="discountAmount"
value="partial"
checked={this.state.overrideValue === 'partial'}
onChange={this.handleOverrideChange}
/>
Teacher should receive full discount code (without AK/HI
shipping)
</label>
<label>
<input
style={styles.radio}
Expand All @@ -246,8 +266,8 @@ export default class DiscountAdminOverride extends Component {
checked={this.state.overrideValue === 'full'}
onChange={this.handleOverrideChange}
/>
Teacher should receive 100% discount code (kit price would
become $0)
Teacher should receive full discount code (with AK/HI
shipping)
</label>
</div>
<Button
Expand Down
1 change: 1 addition & 0 deletions apps/src/lib/kits/maker/ui/DiscountAdminOverride.story.jsx
Expand Up @@ -12,6 +12,7 @@ export default storybook => {
story: () => (
<DiscountAdminOverride
statusPD={Status.SUCCEEDED}
statusAcademicYearPD={Status.SUCCEEDED}
statusStudentCount={Status.FAILED}
/>
)
Expand Down
14 changes: 11 additions & 3 deletions apps/src/lib/kits/maker/ui/EligibilityChecklist.jsx
Expand Up @@ -20,6 +20,7 @@ const styles = {
export default class EligibilityChecklist extends React.Component {
static propTypes = {
statusPD: PropTypes.oneOf(Object.values(Status)).isRequired,
statusAcademicYearPD: PropTypes.oneOf(Object.values(Status)).isRequired,
statusStudentCount: PropTypes.oneOf(Object.values(Status)).isRequired,
unit6Intention: PropTypes.string,
schoolId: PropTypes.string,
Expand Down Expand Up @@ -149,6 +150,12 @@ export default class EligibilityChecklist extends React.Component {
>
<SafeMarkdown markdown={eligibilityReqPDFail} />
</ValidationStep>
<ValidationStep
stepName={i18n.eligibilityReqAcademicYearPD()}
stepStatus={this.props.statusAcademicYearPD}
>
<SafeMarkdown markdown={eligibilityReqPDFail} />
</ValidationStep>
<ValidationStep
stepName={i18n.eligibilityReqStudentCount()}
stepStatus={this.props.statusStudentCount}
Expand All @@ -159,6 +166,7 @@ export default class EligibilityChecklist extends React.Component {
showRadioButtons={
this.props.statusStudentCount === Status.SUCCEEDED &&
this.props.statusPD === Status.SUCCEEDED &&
this.props.statusAcademicYearPD === Status.SUCCEEDED &&
!this.props.adminSetStatus
}
stepStatus={this.state.statusYear}
Expand Down Expand Up @@ -196,7 +204,7 @@ export default class EligibilityChecklist extends React.Component {
const discountPageHeader = `Subsidized Circuit Playground Kits`;
const discountPageDescriptionMd = `
Code.org is able to offer a 100% subsidy for one Circuit Playground classroom kit to eligible
teachers at schools with 40% or greater free and reduced-price meals. To learn more about
teachers at schools with 50% or greater free and reduced-price meals. To learn more about
the full eligibility requirements, read the overview [here](//code.org/circuitplayground).
`;

Expand All @@ -216,7 +224,7 @@ Just use the code \`ADAEDU\` at checkout.

const schoolIsNotEligibleMd = ncesId => `
Unfortunately, you’re not eligible for the Code.org-provided subsidy for the kit because
your school has fewer than 40% of students that are eligible for free/reduced-price lunches
your school has fewer than 50% of students that are eligible for free/reduced-price lunches
([source](https://nces.ed.gov/ccd/schoolsearch/school_detail.asp?ID=${ncesId})).
However, you are still eligible for a discount! Adafruit has made available a 10% off educator
discount that this kit is eligible for. Just use the code \`ADAEDU\` at checkout.
Expand All @@ -237,5 +245,5 @@ Sorry, it doesn’t look like you have enough students in your sections that hav
Units 2 and 3. Please check back here once your students have finished the first semester of
CS Discoveries. If you are using a different account to track the progress of students or if you
think there has been an error in detecting how much progress your students have made in Units
2 and 3, please contact us at [teacher@code.org](mailto:teacher@code.org).
2 and 3, please contact us at [teacher@code.org](mailto:teacher@code.org).
`;
17 changes: 9 additions & 8 deletions apps/src/lib/kits/maker/ui/EligibilityChecklist.story.jsx
Expand Up @@ -5,6 +5,7 @@ import {Unit6Intention} from '../util/discountLogic';

const defaultProps = {
statusPD: Status.SUCCEEDED,
statusAcademicYearPD: Status.SUCCEEDED,
statusStudentCount: Status.SUCCEEDED,
hasConfirmedSchool: false,
adminSetStatus: false,
Expand All @@ -16,16 +17,16 @@ export default storybook => {
.storiesOf('MakerToolkit/Discounts/EligibilityChecklist', module)
.addStoryTable([
{
name: '2019: Initial view',
description: 'New format for 2019',
name: '2020: Initial view',
description: 'New format for 2020',
story: () => (
<div style={{margin: '2em'}}>
<EligibilityChecklist {...defaultProps} />
</div>
)
},
{
name: '2019: School is not eligible',
name: '2020: School is not eligible',
description: 'When your school does not qualify',
story: () => (
<div style={{margin: '2em'}}>
Expand All @@ -40,7 +41,7 @@ export default storybook => {
)
},
{
name: '2019: Student count and facilitator failure',
name: '2020: Student count and facilitator failure',
description: 'When your school does qualify',
story: () => (
<div style={{margin: '2em'}}>
Expand All @@ -57,7 +58,7 @@ export default storybook => {
)
},
{
name: '2019: Student count and facilitator success',
name: '2020: Student count and facilitator success',
description: 'When your school does qualify',
story: () => (
<div style={{margin: '2em'}}>
Expand All @@ -72,7 +73,7 @@ export default storybook => {
)
},
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add stories to this file for the scenario where the academic year PD requirement has not been passed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

name: '2019: Year choice failure',
name: '2020: Year choice failure',
description: 'When you are not planning to teach this or next year',
story: () => (
<div style={{margin: '2em'}}>
Expand All @@ -88,7 +89,7 @@ export default storybook => {
)
},
{
name: '2019: Year choice success',
name: '2020: Year choice success',
description: 'When you are planning to teach this or next year',
story: () => (
<div style={{margin: '2em'}}>
Expand All @@ -98,7 +99,7 @@ export default storybook => {
schoolName="Code.org Junior Academy"
hasConfirmedSchool={true}
getsFullDiscount={true}
unit6Intention={Unit6Intention.YES_18_19}
unit6Intention={Unit6Intention.YES_SPRING_2020}
/>
</div>
)
Expand Down
15 changes: 12 additions & 3 deletions apps/src/lib/kits/maker/ui/Unit6ValidationStep.jsx
Expand Up @@ -92,9 +92,18 @@ export default class Unit6ValidationStep extends Component {
</strong>
{[
[Unit6Intention.NO, i18n.eligibilityYearNo()],
[Unit6Intention.YES_18_19, i18n.eligibilityYearYes1819()],
[Unit6Intention.YES_19_20, i18n.eligibilityYearYes1920()],
[Unit6Intention.YES_AFTER, i18n.eligibilityYearAfter()],
[
Unit6Intention.YES_SPRING_2020,
i18n.eligibilityYearYesSpring2020()
],
[
Unit6Intention.YES_FALL_2020,
i18n.eligibilityYearYesFall2020()
],
[
Unit6Intention.YES_SPRING_2021,
i18n.eligibilityYearYesSpring2021()
],
[Unit6Intention.UNSURE, i18n.eligibilityYearUnknown()]
].map(([value, description]) => (
<label key={value}>
Expand Down
14 changes: 8 additions & 6 deletions apps/src/lib/kits/maker/util/discountLogic.js
Expand Up @@ -7,9 +7,9 @@
*/
export const Unit6Intention = {
NO: 'no',
YES_18_19: 'yes1819',
YES_19_20: 'yes1920',
YES_AFTER: 'yesAfter',
YES_SPRING_2020: 'yesSpring2020',
YES_FALL_2020: 'yesFall2020',
YES_SPRING_2021: 'yesSpring2021',
UNSURE: 'unsure'
};

Expand All @@ -19,7 +19,9 @@ export const Unit6Intention = {
* teacher's eligibility for a discount code.
*/
export function isUnit6IntentionEligible(unit6Intention) {
return [Unit6Intention.YES_18_19, Unit6Intention.YES_19_20].includes(
unit6Intention
);
return [
Unit6Intention.YES_SPRING_2020,
Unit6Intention.YES_FALL_2020,
Unit6Intention.YES_SPRING_2021
].includes(unit6Intention);
}
5 changes: 5 additions & 0 deletions apps/src/sites/studio/pages/maker/discountcode.js
Expand Up @@ -22,6 +22,11 @@ $(document).ready(() => {
statusPD={
application.is_pd_eligible ? Status.SUCCEEDED : Status.FAILED
}
statusAcademicYearPD={
application.is_quarterly_workshop_pd_eligible
? Status.SUCCEEDED
: Status.FAILED
}
statusStudentCount={
application.is_progress_eligible ? Status.SUCCEEDED : Status.FAILED
}
Expand Down
11 changes: 6 additions & 5 deletions apps/test/unit/lib/kits/maker/ui/EligibilityChecklistTest.js
Expand Up @@ -8,6 +8,7 @@ import {Unit6Intention} from '@cdo/apps/lib/kits/maker/util/discountLogic';
describe('EligibilityChecklist', () => {
const defaultProps = {
statusPD: Status.SUCCEEDED,
statusAcademicYearPD: Status.SUCCEEDED,
statusStudentCount: Status.SUCCEEDED,
hasConfirmedSchool: false,
adminSetStatus: false,
Expand Down Expand Up @@ -58,7 +59,7 @@ describe('EligibilityChecklist', () => {
const wrapper = shallow(
<EligibilityChecklist
{...defaultProps}
unit6Intention={Unit6Intention.YES_18_19}
unit6Intention={Unit6Intention.YES_SPRING_2020}
schoolId="12345"
schoolName="Code.org Junior Academy"
hasConfirmedSchool={true}
Expand All @@ -72,7 +73,7 @@ describe('EligibilityChecklist', () => {
const wrapper = shallow(
<EligibilityChecklist
{...defaultProps}
unit6Intention={Unit6Intention.YES_18_19}
unit6Intention={Unit6Intention.YES_SPRING_2020}
schoolId="12345"
schoolName="Code.org Junior Academy"
hasConfirmedSchool={true}
Expand All @@ -89,7 +90,7 @@ describe('EligibilityChecklist', () => {
const wrapper = shallow(
<EligibilityChecklist
{...defaultProps}
unit6Intention={Unit6Intention.YES_18_19}
unit6Intention={Unit6Intention.YES_SPRING_2020}
schoolId="12345"
schoolName="Code.org Junior Academy"
hasConfirmedSchool={true}
Expand All @@ -107,7 +108,7 @@ describe('EligibilityChecklist', () => {
const wrapper = shallow(
<EligibilityChecklist
{...defaultProps}
unit6Intention={Unit6Intention.YES_18_19}
unit6Intention={Unit6Intention.YES_SPRING_2020}
initialDiscountCode="MYCODE"
initialExpiration="2018-12-31T00:00:00.000Z"
getsFullDiscount={false}
Expand All @@ -120,7 +121,7 @@ describe('EligibilityChecklist', () => {
const wrapper = shallow(
<EligibilityChecklist
{...defaultProps}
unit6Intention={Unit6Intention.YES_18_19}
unit6Intention={Unit6Intention.YES_SPRING_2020}
adminSetStatus={true}
getsFullDiscount={true}
/>
Expand Down
5 changes: 3 additions & 2 deletions apps/test/unit/lib/kits/maker/ui/Unit6ValidationStepTest.js
Expand Up @@ -50,11 +50,12 @@ describe('Unit6ValidationStep', () => {
<Unit6ValidationStep
{...defaultProps}
stepStatus={Status.SUCCEEDED}
initialChoice={Unit6Intention.YES_18_19}
initialChoice={Unit6Intention.YES_SPRING_2020}
/>
);
assert.equal(
wrapper.find(`[value="${Unit6Intention.YES_18_19}"]`).props().checked,
wrapper.find(`[value="${Unit6Intention.YES_SPRING_2020}"]`).props()
.checked,
true
);
assert.equal(wrapper.find('Button').length, 0);
Expand Down