Skip to content

Commit

Permalink
Merge pull request #19801 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 5, 2018
2 parents 660dd1d + 70029b3 commit a5c6c08
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 29 deletions.
6 changes: 3 additions & 3 deletions apps/src/feedback.js
Original file line number Diff line number Diff line change
Expand Up @@ -1540,9 +1540,6 @@ FeedbackUtils.prototype.getTestResults = function (levelComplete, requiredBlocks
TestResults.MISSING_RECOMMENDED_BLOCK_FINISHED :
TestResults.MISSING_RECOMMENDED_BLOCK_UNFINISHED;
}
if (this.hasExceededLimitedBlocks_()) {
return TestResults.BLOCK_LIMIT_FAIL;
}
var numEnabledBlocks = this.getNumCountableBlocks();
if (!levelComplete) {
if (this.studioApp_.IDEAL_BLOCK_NUM &&
Expand All @@ -1552,6 +1549,9 @@ FeedbackUtils.prototype.getTestResults = function (levelComplete, requiredBlocks
}
return TestResults.LEVEL_INCOMPLETE_FAIL;
}
if (this.hasExceededLimitedBlocks_()) {
return TestResults.BLOCK_LIMIT_FAIL;
}
if (this.studioApp_.IDEAL_BLOCK_NUM &&
numEnabledBlocks > this.studioApp_.IDEAL_BLOCK_NUM) {
return TestResults.TOO_MANY_BLOCKS_FAIL;
Expand Down
5 changes: 2 additions & 3 deletions apps/src/lib/kits/maker/ui/EligibilityChecklist.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,15 @@ export default class EligibilityChecklist extends Component {
onSchoolConfirmed={this.handleSchoolConfirmed}
/>
}
{this.state.discountAmount && !this.state.getsFullDiscount &&
!this.props.adminSetStatus &&
{this.state.discountAmount === "$97.50" && !this.props.adminSetStatus &&
<div style={styles.discountMessage}>
According to our data, your school has fewer than 50% of students that are
eligible for free/reduced-price lunches. This means that we can bring down
the cost of the $325 kit to just $97.50.{" "}
<strong style={styles.bold}>
If this data seems inaccurate and you believe there are over 50% of students
that are eligible for free/reduced-price lunch at your school, please contact
support@code.org.
teacher@code.org.
</strong>
{" "}
Otherwise, click "Get Code" below.
Expand Down
4 changes: 2 additions & 2 deletions apps/src/maze/bee.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ export default class Bee extends Gatherer {
// If we have a non-app specific failure, we want that to take precedence.
// Values over TOO_MANY_BLOCKS_FAIL are not true failures, but indicate
// a suboptimal solution, so in those cases we want to return our
// app specific fail
if (testResults >= TestResults.TOO_MANY_BLOCKS_FAIL) {
// app specific fail. Same goes for BLOCK_LIMIT_FAIL.
if (testResults >= TestResults.TOO_MANY_BLOCKS_FAIL || testResults === TestResults.BLOCK_LIMIT_FAIL) {
testResults = TestResults.APP_SPECIFIC_FAIL;
}
return testResults;
Expand Down
4 changes: 2 additions & 2 deletions apps/src/maze/harvester.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ export default class Harvester extends Gatherer {
// If we have a non-app specific failure, we want that to take precedence.
// Values over TOO_MANY_BLOCKS_FAIL are not true failures, but indicate
// a suboptimal solution, so in those cases we want to return our
// app specific fail
if (testResults >= TestResults.TOO_MANY_BLOCKS_FAIL) {
// app specific fail. Same goes for BLOCK_LIMIT_FAIL.
if (testResults >= TestResults.TOO_MANY_BLOCKS_FAIL || testResults === TestResults.BLOCK_LIMIT_FAIL) {
testResults = TestResults.APP_SPECIFIC_FAIL;
}
return testResults;
Expand Down
4 changes: 2 additions & 2 deletions apps/src/maze/planter.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ export default class Planter extends Subtype {
// If we have a non-app specific failure, we want that to take precedence.
// Values over TOO_MANY_BLOCKS_FAIL are not true failures, but indicate
// a suboptimal solution, so in those cases we want to return our
// app specific fail
if (testResults >= TestResults.TOO_MANY_BLOCKS_FAIL) {
// app specific fail. Same goes for BLOCK_LIMIT_FAIL.
if (testResults >= TestResults.TOO_MANY_BLOCKS_FAIL || testResults === TestResults.BLOCK_LIMIT_FAIL) {
testResults = TestResults.APP_SPECIFIC_FAIL;
}
return testResults;
Expand Down
33 changes: 28 additions & 5 deletions apps/test/integration/levelSolutions/maze/blockLimits.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const TestResults = require('@cdo/apps/constants.js').TestResults;
const blockUtils = require('@cdo/apps/block_utils');

const levelDef = {
'map': [
Expand All @@ -17,35 +18,57 @@ const levelDef = {
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, -1, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0],
],
flowerType: 'redWithNectar',
toolbox: '<xml id="toolbox"><block type="maze_moveForward" limit="1"></block></xml>',
requiredBlocks: [],
honeyGoal: 1,
};

module.exports = {
app: "maze",
skinId: "bee",
levelDefinition: levelDef,
tests: [{
description: "Limited toolbox blocks - over limit",
description: "Limited toolbox blocks - fail goal",
expected: {
result: false,
testResult: TestResults.APP_SPECIFIC_FAIL,
},
missingBlocks: [],
xml: '<xml>' +
blockUtils.blocksFromList([
"maze_moveForward",
"maze_moveForward",
]) + '</xml>',
}, {
description: "Limited toolbox blocks - pass goal, over limit",
expected: {
result: true,
testResult: TestResults.BLOCK_LIMIT_FAIL,
},
missingBlocks: [],
xml: '<xml><block type="when_run"><next><block type="maze_moveForward"><next><block type="maze_moveForward"></block></next></block></next></block></xml>'
xml: '<xml>' +
blockUtils.blocksFromList([
"maze_moveForward",
"maze_honey",
"maze_moveForward",
]) + '</xml>',
}, {
description: "Limited toolbox blocks - under limit",
description: "Limited toolbox blocks - pass goal, under limit",
expected: {
result: true,
testResult: TestResults.ALL_PASS,
},
missingBlocks: [],
xml: '<xml><block type="when_run"><next><block type="maze_moveForward"></block></next></block></xml>'
xml: '<xml>' +
blockUtils.blocksFromList([
"maze_moveForward",
"maze_honey",
]) + '</xml>',
}]
};
28 changes: 28 additions & 0 deletions apps/test/unit/lib/kits/maker/ui/EligibilityChecklistTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,32 @@ describe('EligibilityChecklist', () => {
);
assert.equal(wrapper.find('div').last().text(), i18n.eligibilityReqYearFail());
});

it('shows discount message when partial discount', () => {
const wrapper = shallow(
<EligibilityChecklist
{...defaultProps}
unit6Intention="yes1718"
schoolId="12345"
schoolName="Code.org Junior Academy"
hasConfirmedSchool={true}
getsFullDiscount={false}
/>
);
assert(wrapper.text().includes("According to our data, your school has fewer than 50% of students"));
});

it('does not show discount message when full discount', () => {
const wrapper = shallow(
<EligibilityChecklist
{...defaultProps}
unit6Intention="yes1718"
schoolId="12345"
schoolName="Code.org Junior Academy"
hasConfirmedSchool={true}
getsFullDiscount={true}
/>
);
assert(!wrapper.text().includes("According to our data, your school has fewer than 50% of students"));
});
});
12 changes: 8 additions & 4 deletions dashboard/config/scripts/csp_algorithms_map.external
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,18 @@ Automation typically results in tasks that are completed more quickly, easily, a
<em>drawRectangle()</em> and <em>right()</em> are examples of abstraction because they capture the code for more complex behavior and simplify the representation of that behavior by giving it a single name.
</div>

**Computers - Information Machines**
**Tools for Thinking Tasks**

Many of the daily tasks we do are thinking tasks like keeping track of money, remembering birthdays, or scheduling tasks for the day. Just like physical tasks, thinking tasks can be monotonous or challenging, and so we've made tools to help us complete them. Calendars, clocks, financial records, and books help us keep track of and make sense of information.

Just like physical tasks, humans want tools to automate our thinking tasks. It was this desire that led to the creation of the computer. Computers store and process information to complete all kinds of information tasks automatically.
Many of our daily tasks don't involve physical work and instead just require thinking. For example keeping track of money, remembering birthdays, or scheduling activities. Just like physical tasks, thinking tasks can be monotonous or challenging, and so we've made tools to help us complete them. For example calendars, clocks, financial records, and books help us with different thinking tasks.

**Programming - Communicating algorithms to a computer**

Thinking tasks deal with information. In order to automate thinking tasks humans needed to design

Just like with physical tasks, humans want tools to automate their thinking tasks. This is essentially what computers are, information processing tools for automating thinking tasks.

Computers

A program is a set of instructions to complete some task using the tools made available to you in a programming language. In other words, a program is an algorithm for completing a task. The difference between a computer and human algorithm is the extreme precision of a programming language. Computers require instructions that can only have a single, unambiguous meaning. Computer languages only contain a relatively small set of single individual commands that the computer is capable of running. In order to design an algorithm, you need to combine these commands together.

**Sequence, Selection, Iteration**
Expand Down
5 changes: 1 addition & 4 deletions dashboard/config/scripts/levels/CSDU6 play songs.level
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@
"fail_on_lint_errors": "false",
"debugger_disabled": "false",
"makerlab_enabled": "true",
"contained_level_names": null,
"encrypted_examples": [

]
"contained_level_names": null
},
"published": true,
"notes": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
"discard_background": "false",
"hide_share_and_remix": "false",
"disable_if_else_editing": "true",
"contained_level_names": null,
"disable_procedure_autopopulate": "false",
"top_level_procedure_autopopulate": "false"
"top_level_procedure_autopopulate": "false",
"contained_level_names": null
},
"published": true,
"notes": "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@
"discard_background": "false",
"hide_share_and_remix": "false",
"disable_if_else_editing": "true",
"contained_level_names": null,
"disable_procedure_autopopulate": "false",
"top_level_procedure_autopopulate": "false"
"top_level_procedure_autopopulate": "false",
"contained_level_names": null
},
"published": true,
"notes": "",
Expand Down

0 comments on commit a5c6c08

Please sign in to comment.