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

DTL (Test > Levelbuilder): e56c8ff5 #36929

Merged
merged 80 commits into from
Sep 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
a6089c4
background logic changes
JillianK Sep 2, 2020
acec86d
updated animationPickerBodyTest default props to have new props
JillianK Sep 2, 2020
aafa5c0
added animation picker module tests
JillianK Sep 2, 2020
564b444
Merge branch 'staging' of github.com:code-dot-org/code-dot-org into j…
JillianK Sep 8, 2020
b19ae35
added new fields
JillianK Sep 8, 2020
7589c8a
moved over to new props
JillianK Sep 8, 2020
7b145bc
updated test props fields
JillianK Sep 10, 2020
4fe2677
Merge branch 'i18n-maker-setup' into i18n-maker-setup-list
Sep 10, 2020
441dffc
Make string a shared constant
Sep 11, 2020
7d957da
i18n Chrome specific setup
Sep 11, 2020
0705b5f
i18n unsupported browser
Sep 14, 2020
6be1a34
i18n Validation step names
Sep 14, 2020
a57df2c
Merge branch 'staging' into i18n-maker-setup-list
Sep 14, 2020
5ac1d4e
Validation steps i18n
Sep 14, 2020
80b697e
i18n install firmata step
Sep 14, 2020
924b9a1
I think I resolved comments
JillianK Sep 14, 2020
c858766
fixed block
JillianK Sep 15, 2020
de48235
Prevent progress from leaking to a logged out user
jmkulwik Sep 1, 2020
8443f07
Updated tests
jmkulwik Sep 16, 2020
c49b892
Updated ui tests.
jmkulwik Sep 16, 2020
bb85709
made changes
JillianK Sep 16, 2020
f516408
moved string to i18n
JillianK Sep 16, 2020
e660863
i18n linux steps
Sep 16, 2020
99ce8ed
import correct i18n
Sep 16, 2020
a4682cf
Merge branch 'staging' into i18n-maker-setup-list
Sep 16, 2020
12763bf
i18n port scanning error
Sep 16, 2020
d5ad2f1
Merge branch 'staging' of github.com:code-dot-org/code-dot-org into j…
JillianK Sep 17, 2020
d80bb3c
Updates from Code Review comments
jmkulwik Sep 19, 2020
70b2e77
resolved comments and fixed costume library behavior
JillianK Sep 21, 2020
b3cef7d
fix tests
JillianK Sep 21, 2020
4964d99
Add microbit description to the maker setup page
Sep 21, 2020
be009a7
Merge branch 'staging' into i18n-maker-setup-list
Sep 21, 2020
375205b
PR feedback on strings
Sep 22, 2020
5483eb2
resolved comments
JillianK Sep 23, 2020
968b617
add student_overview to lessons controller tests
davidsbailey Sep 23, 2020
d48062e
change lessons update API to use camelCase
davidsbailey Sep 23, 2020
fad8181
reject unexpected keys on update
davidsbailey Sep 23, 2020
b4e4f9a
Merge branch 'staging' of github.com:code-dot-org/code-dot-org into j…
JillianK Sep 23, 2020
26bc922
use transform_keys and snake case
davidsbailey Sep 23, 2020
ec0905d
wrap editable data in an envelope
davidsbailey Sep 23, 2020
def1290
Fixed failing test
jmkulwik Sep 23, 2020
94881bd
Merge remote-tracking branch 'origin/staging' into clear-logged-out-s…
jmkulwik Sep 24, 2020
1e037fb
rename editableData to lesson
davidsbailey Sep 23, 2020
470cdc4
add integration test verifying that edit and update APIs use the same…
davidsbailey Sep 24, 2020
ced8cfb
remove unused codemirror-rails gem
Hamms Sep 24, 2020
c133eb5
changed variable name
JillianK Sep 24, 2020
ee7ee63
Merge pull request #36782 from code-dot-org/clear-logged-out-session-…
jmkulwik Sep 24, 2020
02b988e
Merge pull request #36906 from code-dot-org/staging
deploy-code-org Sep 24, 2020
1c24b41
use PropTypes.checkPropTypes to validate activities in redux
davidsbailey Sep 24, 2020
9430ad9
remove unused id param from lesson edit page
davidsbailey Sep 25, 2020
d8166e9
Revert "rename editableData to lesson"
davidsbailey Sep 25, 2020
95b9f72
fix lessons integration test
davidsbailey Sep 25, 2020
d3a0052
Removed feature that auto updates progress when the progress changes …
jmkulwik Sep 25, 2020
f84a3b3
Merge pull request #36910 from code-dot-org/stop-auto-green
jmkulwik Sep 25, 2020
52affcb
Merge pull request #36911 from code-dot-org/staging
deploy-code-org Sep 25, 2020
bc629d5
Revert "Merge pull request #36884 from code-dot-org/activerecord-impo…
Sep 25, 2020
fc60e21
Merge pull request #36912 from code-dot-org/seed-custom-levels-perfor…
Sep 25, 2020
e7f9719
Merge pull request #36913 from code-dot-org/staging
deploy-code-org Sep 25, 2020
c4209c5
remove redundant self.use_transactional_test_case
davidsbailey Sep 25, 2020
c0c6b9a
rename activity time to duration in js
davidsbailey Sep 25, 2020
19cc3d6
fix ActivityCardTest syntax
davidsbailey Sep 25, 2020
077f448
rename Time to Duration in the activity edit UI
davidsbailey Sep 25, 2020
24a55ec
Merge pull request #36875 from code-dot-org/lesson-api-camelCase
davidsbailey Sep 25, 2020
a9fb312
Merge pull request #36908 from code-dot-org/check-activity-prop-type
davidsbailey Sep 25, 2020
b6f44b2
Merge pull request #36916 from code-dot-org/staging
deploy-code-org Sep 25, 2020
50ed1e0
Merge branch 'staging' into activity-time-duration
davidsbailey Sep 25, 2020
47f7cc2
Css syntax cleanup
Sep 25, 2020
8591ec6
Merge pull request #36914 from code-dot-org/activity-time-duration
davidsbailey Sep 25, 2020
8ea5256
Merge pull request #36917 from code-dot-org/staging
deploy-code-org Sep 25, 2020
ef875b6
Merge pull request #36578 from code-dot-org/jk-background-logic
JillianK Sep 25, 2020
0138920
Merge pull request #36919 from code-dot-org/staging
deploy-code-org Sep 25, 2020
bf7194f
Merge pull request #36851 from code-dot-org/mb-description
Sep 25, 2020
8b12dea
Merge pull request #36921 from code-dot-org/staging
deploy-code-org Sep 25, 2020
b3a810b
staging content changes (-robo-commit)
deploy-code-org Sep 25, 2020
a763c3e
Merge pull request #36922 from code-dot-org/staging
deploy-code-org Sep 25, 2020
92d2160
Merge pull request #36923 from code-dot-org/levelbuilder
deploy-code-org Sep 25, 2020
db80eca
Merge pull request #36924 from code-dot-org/staging
deploy-code-org Sep 25, 2020
82dd05b
Merge pull request #36899 from code-dot-org/remove-codemirror-rails
Hamms Sep 25, 2020
1aa7bca
Merge pull request #36787 from code-dot-org/i18n-maker-setup-list
Sep 25, 2020
e56c8ff
Merge pull request #36925 from code-dot-org/staging
deploy-code-org Sep 25, 2020
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
4 changes: 1 addition & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,6 @@ gem 'mini_racer'

gem 'jwt' # single signon for zendesk

gem 'codemirror-rails' # edit code in textarea

gem 'twilio-ruby' # SMS API for send-to-phone feature

# We also serve a copy of one of these font files from the public directory
Expand Down Expand Up @@ -340,7 +338,7 @@ install_if require_pg do
end

gem 'active_record_union'
gem 'activerecord-import', '~> 0.26'
gem 'activerecord-import'
gem 'scenic'
gem 'scenic-mysql_adapter'

Expand Down
7 changes: 2 additions & 5 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ GEM
activemodel (= 5.0.7.2)
activesupport (= 5.0.7.2)
arel (~> 7.0)
activerecord-import (0.28.2)
activerecord-import (0.22.0)
activerecord (>= 3.2)
activesupport (5.0.7.2)
concurrent-ruby (~> 1.0, >= 1.0.2)
Expand Down Expand Up @@ -353,8 +353,6 @@ GEM
codecov (0.2.8)
json
simplecov
codemirror-rails (5.16.0)
railties (>= 3.0, < 6.0)
coderay (1.1.1)
colorize (0.8.1)
composite_primary_keys (9.0.10)
Expand Down Expand Up @@ -901,7 +899,7 @@ DEPENDENCIES
active_model_serializers (~> 0.10.0)
active_record_query_trace
active_record_union
activerecord-import (~> 0.26)
activerecord-import
acts_as_list
addressable
annotate
Expand Down Expand Up @@ -931,7 +929,6 @@ DEPENDENCIES
cancancan (~> 1.15.0)
chronic (~> 0.10.2)
codecov
codemirror-rails
colorize
composite_primary_keys
cucumber
Expand Down
20 changes: 20 additions & 0 deletions apps/i18n/applab/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -343,27 +343,47 @@
"dropletBlock_write_description": "Appends the specified text to the bottom of the document. The text can also be formatted as HTML.",
"dropletBlock_write_param0_description": "The text or HTML you want appended to the bottom of your application",
"finalLevel": "Congratulations! You have solved the final puzzle.",
"foundDevices": "Did not find a usable device on a serial port.\n\nFound devices: {deviceList}",
"legacy": "(Legacy)",
"makeMyOwnApp": "Make my own app",
"makerSetupAcceptPrompt": "If a prompt asking for permission for Code Studio to connect to the Chrome App pops up, click Accept.",
"makerSetupAdafruitWindowsDrivers": "If your board is plugged in, you may be missing the **Adafruit Windows Drivers**. Follow the instructions [on this page](https://learn.adafruit.com/adafruit-feather-32u4-basic-proto/using-with-arduino-ide#install-drivers-windows-only) to install the drivers and try again.",
"makerSetupAppInstalled": "Chrome App installed",
"makerSetupBoardBadResponse": "We found a board but it didn't respond properly when we tried to connect to it.",
"makerSetupBrowserTitle": "Code.org Browser",
"makerSetupBrowserSupported": "Using a supported browser",
"makerSetupCheck": "Setup Check",
"makerSetupCheckInternetConnection": "Please make sure you are connected to the internet, and [https://downloads.code.org](https://downloads.code.org/index.html) is reachable from your network.",
"makerSetupChromebookPage": "Open this page ([{makerSetupPage}]({makerSetupPage})) on your Chromebook.",
"makerSetupDownloadAndInstall": "Download and install the Code.org Maker App using the download button above.",
"makerSetupDownloadProblem": "There was a problem getting your download link.",
"makerSetupFetchingVersion": "Getting the latest version...",
"makerSetupFollowInstructions": "Follow the instructions given by the interactive setup checklist.",
"makerSetupInstallSerialConnector": "Please install the [Code.org Serial Connector Chrome App]({webstoreURL}).",
"makerSetupInstallFirmata": "You should make sure it has the right firmware sketch installed. You can [install the Circuit Playground Firmata sketch with these instructions]({firmataURL}).",
"makerSetupLinuxAddDialout": "If you don't belong to 'dialout', you'll want to add yourself to that group:",
"makerSetupLinuxAlternative": "Alternative Installers",
"makerSetupLinuxAlternativeInstall": "[Install from source](https://github.com/code-dot-org/browser)",
"makerSetupLinuxGroupsCheck": "From your terminal, check which groups you belong to:",
"makerSetupLinuxRestart": "You may need to restart your computer for changes to take effect.",
"makerSetupLinuxSerialport": "We didn't have permission to open the serialport. Please make sure you are a member of the 'dialout' group.",
"makerSetupMakerAppForChromebook": "Maker Toolkit for Chromebook",
"makerSetupMakerAppForLinux": "Code.org Maker App for Linux",
"makerSetupMakerAppForMac": "Code.org Maker App for Mac",
"makerSetupMakerAppForWindows": "Code.org Maker App for Windows",
"makerSetupPlugInBoard": "Plug in your board to start using it with App Lab!",
"makerSetupPlugInBoardCheck": "We couldn't detect a Circuit Playground board. Make sure your board is plugged in, and click: ",
"makerSetupRedetect": "Once it is installed, come back to this page and click the \"re-detect\" button, above.",
"makerSetupSerialConnector": "Maker Toolkit on Chromebook does not use the Code.org Maker App. Instead, it depends on the [Code.org Serial Connector]({webstoreURL}) Chrome App.",
"makerSetupSignIn": "Open up the Code.org Maker App and sign in to Code.org.",
"makerSetupUnsupportedBrowser": "Your current browser is not supported at this time. Please install the latest version of [Google Chrome](https://www.google.com/chrome/browser).",
"makerSetupVerifyComponents": "Oh no! Something unexpected went wrong while verifying the board components.",
"makerSetupWindows7Drivers": "(Windows 7) Install the [Adafruit Windows drivers](https://learn.adafruit.com/adafruit-feather-32u4-basic-proto/using-with-arduino-ide#install-drivers-windows-only).",
"manageAssets": "Click to view or update your images and sounds.",
"nextLevel": "Congratulations! You have completed this puzzle.",
"no": "No",
"numBlocksNeeded": "This puzzle can be solved with %1 blocks.",
"redetect": "re-detect",
"reinfFeedbackMsg": "Are you finished? With App Lab, you're in control - it's up to you to check your work and decide when you're done.",
"repeatForever": "repeat forever",
"repeatDo": "do",
Expand Down
4 changes: 3 additions & 1 deletion apps/i18n/common/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"abusiveUrl": "URL of the content being reported",
"achievements": "Achievements",
"activity": "Activity",
"activityHeader": "{activityName} ({activityTime} minutes)",
"activityHeader": "{activityName} ({activityDuration} minutes)",
"actions": "Actions",
"add": "Add",
"addNewSection": "Add New Section",
Expand Down Expand Up @@ -69,6 +69,7 @@
"animationCategory_tools": "Tools",
"animationCategory_vehicles": "Vehicles",
"animationMode": "Animation",
"animationPicker_allCategories": "All categories",
"animationPicker_drawYourOwn": "Draw your own",
"animationPicker_error": "Error: {message}",
"animationPicker_failedToParseImage": "The image could not be parsed",
Expand Down Expand Up @@ -879,6 +880,7 @@
"inProgress": "In progress",
"inspireStudents": "Inspire students",
"instructions": "Instructions",
"instructionsWithColon": "Instructions:",
"intlAnnouncementSpecial2020Body": "Students can continue to learn at home while schools are closed. Take a Code Break with us, or see resources for students, parents, and teachers - including videos, fun tutorials, and projects! Most options only available in English.",
"intlAnnouncementSpecial2020Heading": "More resources for learning at home",
"invalidDataEntryTypeError": "Value must be boolean, number, string, `undefined`, or `null`. Make sure to include quotes for strings like \"this\". ",
Expand Down
6 changes: 6 additions & 0 deletions apps/src/code-studio/assets/searchAssets.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,9 @@ export function searchAssets(
)
};
}

export function filterOutBackgrounds(assets) {
return assets.filter(
animation => !animation.categories.includes('backgrounds')
);
}
72 changes: 5 additions & 67 deletions apps/src/code-studio/clientState.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import cookies from 'js-cookie';
// Note: sessionStorage is not shared between tabs.
var sessionStorage = window.sessionStorage;

import {mergeActivityResult} from './activityUtils';

var clientState = (module.exports = {});

clientState.queryParams = require('./utils').queryParams;
Expand Down Expand Up @@ -45,6 +43,10 @@ clientState.reset = function() {
} catch (e) {}
};

clientState.clearProgress = function() {
sessionStorage.removeItem('progress');
};

/**
* Returns the client-cached copy of the level source for the given script
* level, if it's newer than the given timestamp.
Expand Down Expand Up @@ -96,44 +98,16 @@ clientState.writeSourceForLevel = function(
);
};

/**
* Returns the progress attained for the given level.
* @param {string} scriptName The script name
* @param {number} levelId The level
* @returns {number}
*/
clientState.levelProgress = function(scriptName, levelId) {
var progressMap = clientState.allLevelsProgress();
return (progressMap[scriptName] || {})[levelId] || 0;
};

/**
* Tracks the users progress after they click run. Results larger than 999 are
* reserved for server-dependent changes and can't be cached locally.
* @param {boolean} result - Whether the user's solution is successful
* @param {number} lines - Number of lines of code user wrote in this solution
* @param {TestResult} testResult - Indicates pass, fail, perfect
* @param {string} scriptName - Which script this is for
* @param {number} levelId - Which level this is for
*/
clientState.trackProgress = function(
result,
lines,
testResult,
scriptName,
levelId
) {
clientState.trackLines = function(result, lines) {
if (result && isFinite(lines)) {
addLines(lines);
}

var savedResult = clientState.levelProgress(scriptName, levelId);
if (
testResult <= clientState.MAXIMUM_CACHABLE_RESULT &&
savedResult !== mergeActivityResult(savedResult, testResult)
) {
setLevelProgress(scriptName, levelId, testResult);
}
};

/**
Expand All @@ -159,21 +133,6 @@ clientState.batchTrackProgress = function(scriptName, progress) {
trySetSessionStorage('progress', JSON.stringify(progressMap));
};

/**
* Sets the progress attained for the given level
* @param {string} scriptName The script name
* @param {number} levelId The level
* @param {number} progress Indicates pass, fail, perfect
*/
function setLevelProgress(scriptName, levelId, progress) {
var progressMap = clientState.allLevelsProgress();
if (!progressMap[scriptName]) {
progressMap[scriptName] = {};
}
progressMap[scriptName][levelId] = progress;
trySetSessionStorage('progress', JSON.stringify(progressMap));
}

/**
* Returns a map from (string) level id to progress value.
* @return {Object<String, number>}
Expand All @@ -188,27 +147,6 @@ clientState.allLevelsProgress = function() {
}
};

/**
* Returns the best progress of any of the specified levels
* @param {Array.<number>} levelIds List of level ids to check for progress
* @param {string} scriptName Script in which to check for progress
* @param {Object=} progress A map from level id to progress values. Will be
* fetched from sessionStorage if not provided.
*/
clientState.bestProgress = function(levelIds, scriptName, progress) {
if (!progress) {
progress = clientState.allLevelsProgress();
}
return (
Math.max.apply(
Math,
levelIds
.filter(id => progress[scriptName][id])
.map(id => progress[scriptName][id])
) || 0
);
};

/**
* Returns the number of lines completed from the cookie.
* @returns {number}
Expand Down
7 changes: 6 additions & 1 deletion apps/src/code-studio/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
refreshProjectName,
setShowTryAgainDialog
} from './headerRedux';
import {useDbProgress} from './progressRedux';

import React from 'react';
import ReactDOM from 'react-dom';
Expand Down Expand Up @@ -73,6 +74,10 @@ header.build = function(
scriptNameData,
hasAppOptions
) {
const store = getStore();
if (progressData) {
store.dispatch(useDbProgress());
}
scriptData = scriptData || {};
lessonGroupData = lessonGroupData || {};
lessonData = lessonData || {};
Expand All @@ -99,7 +104,7 @@ header.build = function(
// the opportunity to wait until the app is loaded before rendering.
$(document).ready(function() {
ReactDOM.render(
<Provider store={getStore()}>
<Provider store={store}>
<HeaderMiddle
scriptNameData={scriptNameData}
lessonData={lessonData}
Expand Down
21 changes: 5 additions & 16 deletions apps/src/code-studio/initApp/loadApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import React from 'react';
import ReactDOM from 'react-dom';
import {TestResults} from '@cdo/apps/constants';
import {getStore} from '../redux';
import {clearProgress, mergeProgress} from '../progressRedux';
import {overwriteProgress, useDbProgress} from '../progressRedux';
import {SignInState} from '@cdo/apps/templates/currentUserRedux';
import {setVerified} from '@cdo/apps/code-studio/verifiedTeacherRedux';
import {
Expand Down Expand Up @@ -58,27 +58,16 @@ function mergeProgressData(scriptName, serverProgress) {
const store = getStore();

// The server returned progress. This is the source of truth.
// Note: Changes to the progressRedux also update the sessionStorage,
// so this will clear and update the sessionStorage too.
store.dispatch(clearProgress());
store.dispatch(useDbProgress());

// Clear any existing redux state.
store.dispatch(
mergeProgress(
overwriteProgress(
_.mapValues(serverProgress, level =>
level.submitted ? TestResults.SUBMITTED_RESULT : level.result
)
)
);

Object.keys(serverProgress).forEach(levelId => {
// Write down new progress in sessionStorage
clientState.trackProgress(
null,
null,
serverProgress[levelId],
scriptName,
levelId
);
});
}

/**
Expand Down
44 changes: 26 additions & 18 deletions apps/src/code-studio/progress.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,32 +294,40 @@ function initializeStoreWithProgress(
// Determine if we are viewing student progress.
var isViewingStudentAnswer = !!clientState.queryParams('user_id');

// Merge in progress saved on the client, unless we are viewing student's work.
if (!isViewingStudentAnswer) {
store.dispatch(
mergeProgress(clientState.allLevelsProgress()[scriptData.name] || {})
);
}

if (scriptData.hideable_lessons) {
// Note: This call is async
store.dispatch(getHiddenStages(scriptData.name, true));
}

store.dispatch(setIsAge13Required(scriptData.age_13_required));

// Progress from the server should be written down locally, unless we're a teacher
// viewing a student's work.
if (!isViewingStudentAnswer) {
let lastProgress;
store.subscribe(() => {
const nextProgress = store.getState().progress.levelProgress;
if (nextProgress !== lastProgress) {
lastProgress = nextProgress;
clientState.batchTrackProgress(scriptData.name, nextProgress);
}
});
// The rest of these actions are only relevant if the current user is the
// owner of the code being viewed.
if (isViewingStudentAnswer) {
return;
}

// We should use client state XOR database state to track user progress
if (!store.getState().progress.usingDbProgress) {
store.dispatch(
mergeProgress(clientState.allLevelsProgress()[scriptData.name] || {})
);
}

let lastProgress;
store.subscribe(() => {
const progressState = store.getState().progress;
const nextProgress = progressState.levelProgress;
const usingDbProgress = progressState.usingDbProgress;

// We should use client state XOR database state to track user progress.
// We may not know until much later, when we load the app, that there
// is state available from the DB.
if (!usingDbProgress && nextProgress !== lastProgress) {
lastProgress = nextProgress;
clientState.batchTrackProgress(scriptData.name, nextProgress);
}
});
}

function initializeStoreWithSections(store, scriptData) {
Expand Down