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

DTP (Test > Production: 12ec0825) #23417

Merged
merged 36 commits into from
Jun 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
5a49aee
localize string that is displayed when mc-survey table is hidden
nkiruka Jun 26, 2018
d4f55e4
add conditional to render function in multiple choice survey overview…
nkiruka Jun 26, 2018
7f74331
wip
nkiruka Jun 26, 2018
4ee0258
wip
nkiruka Jun 27, 2018
7936a2c
Add selector function to check if it is a survey
nkiruka Jun 27, 2018
5b56d85
Add proptype to hide or show assessments or survey tables
nkiruka Jun 27, 2018
1b039fc
Merge remote-tracking branch 'origin/staging' into hide-show-mc-surve…
nkiruka Jun 27, 2018
77b5ab6
remove file
nkiruka Jun 27, 2018
bac05c2
Update submission count selector to use survey type checker
caleybrock Jun 27, 2018
98f2dce
Show explination text if no surveys shown
caleybrock Jun 27, 2018
9c3f2a1
Show no submissions text for empty assessments
caleybrock Jun 27, 2018
0771041
passing tests for currentAssessmentIsSurvey selector function
nkiruka Jun 27, 2018
3b32cca
Updated comments for currentAssessmentIsSurvey function
nkiruka Jun 27, 2018
fe5d72e
Rename column primary_authentication_option_id to primary_contact_inf…
islemaster Jun 27, 2018
3cb1648
update_primary_authentication_option -> update_primary_contact_info
islemaster Jun 27, 2018
76a66dc
Convert existing usages
islemaster Jun 27, 2018
bb76775
Add skip_content_moderation column to storage_apps table
Erin007 Jun 28, 2018
f9d3562
Merge remote-tracking branch 'origin/staging' into rename-primary-aut…
islemaster Jun 28, 2018
311f4c1
fix spacing
nkiruka Jun 28, 2018
c7cf522
Change currentAssessmentIsSurvey function name to isCurrentAssessment…
nkiruka Jun 28, 2018
543eeea
Create a new variable for scriptId
nkiruka Jun 28, 2018
ede2192
Update Blockly through 2.4.2
joshlory Jun 28, 2018
7558499
Test primary_authentication_option aliases
islemaster Jun 28, 2018
66b8da8
Use alias_attribute
islemaster Jun 28, 2018
7c13900
Merge pull request #23397 from code-dot-org/update-blockly
joshlory Jun 28, 2018
dea11ce
Merge pull request #23403 from code-dot-org/staging
aoby Jun 28, 2018
9b22418
Merge pull request #23386 from code-dot-org/hide-show-mc-survey-table
nkiruka Jun 28, 2018
361dd33
Add more context to the Dropbox conflicted copy scary change message
Jun 28, 2018
04a8352
Fix typo [ci skip]
Jun 28, 2018
6db8d70
Merge pull request #23405 from code-dot-org/dropbox-scary-change-more…
aoby Jun 28, 2018
d308852
Merge pull request #23408 from code-dot-org/staging
deploy-code-org Jun 28, 2018
e1de999
Merge pull request #23387 from code-dot-org/rename-primary-authentica…
islemaster Jun 28, 2018
b168e53
Merge pull request #23390 from code-dot-org/skip-content-mod-column
Erin007 Jun 28, 2018
44969c3
Update schema cache dump after schema changes.
deploy-code-org Jun 28, 2018
801e8d4
Merge branch 'staging' of github.com:code-dot-org/code-dot-org into s…
deploy-code-org Jun 28, 2018
12ec082
Merge pull request #23412 from code-dot-org/staging
aoby Jun 28, 2018
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
2 changes: 2 additions & 0 deletions apps/i18n/common/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,8 @@
"emptyExampleBlockErrorMsg": "You need at least two examples in function {functionName}. Make sure each example has a call and a result.",
"emptyFunctionBlocksErrorMsg": "The function block needs to have other blocks inside it to work.",
"emptyFunctionalBlock": "You have a block with an unfilled input.",
"emptySurveyOverviewTable": "Because this survey is anonymous, we can only show aggregated results once there are at least 5 submissions.",
"emptyAssessmentSubmissions": "There are currently no submissions for this assessment.",
"emptyTextResponsesTable": "Most of our classes are designed to work for younger ages and do not require students to type text responses to questions, so you will not see any text responses here. For older students in middle and high school courses, you can see their submissions to open-ended text response questions by choosing the assigned course from the drop down above.",
"emptyTopLevelBlock": "There are no blocks to run. You must attach a block to the {topLevelBlockName} block.",
"enable": "Enable",
Expand Down
2 changes: 1 addition & 1 deletion apps/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"devDependencies": {
"@cdo/apps": "file:src",
"@code-dot-org/artist": "0.2.1",
"@code-dot-org/blockly": "2.4.1",
"@code-dot-org/blockly": "2.4.2",
"@code-dot-org/bramble": "0.1.26",
"@code-dot-org/craft": "0.1.3",
"@code-dot-org/johnny-five": "0.11.1-cdo.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ export const UnconnectedMCAssessmentsOverviewContainer = MCAssessmentsOverviewCo

export default connect(state => ({
questionAnswerData: getMultipleChoiceSectionSummary(state),
totalStudentSubmissions: countSubmissionsForCurrentAssessment(state, false),
totalStudentSubmissions: countSubmissionsForCurrentAssessment(state),
totalStudentCount: getTotalStudentCount(state),
}))(MCAssessmentsOverviewContainer);
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ export const UnconnectedMCSurveyOverviewContainer = MCSurveyOverviewContainer;

export default connect(state => ({
multipleChoiceSurveyData: getMultipleChoiceSurveyResults(state),
totalStudentSubmissions: countSubmissionsForCurrentAssessment(state, true),
totalStudentSubmissions: countSubmissionsForCurrentAssessment(state),
totalStudentCount: getTotalStudentCount(state),
}))(MCSurveyOverviewContainer);
43 changes: 36 additions & 7 deletions apps/src/templates/sectionAssessments/SectionAssessments.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import {
asyncLoadAssessments,
getCurrentScriptAssessmentList,
setAssessmentId,
isCurrentAssessmentSurvey,
countSubmissionsForCurrentAssessment,
} from '@cdo/apps/templates/sectionAssessments/sectionAssessmentsRedux';
import {connect} from 'react-redux';
import {h3Style} from "../../lib/ui/Headings";
Expand Down Expand Up @@ -37,6 +39,8 @@ class SectionAssessments extends Component {
setAssessmentId: PropTypes.func.isRequired,
asyncLoadAssessments: PropTypes.func.isRequired,
multipleChoiceSurveyResults: PropTypes.array,
isCurrentAssessmentSurvey: PropTypes.bool,
totalStudentSubmissions: PropTypes.number,
};

onChangeScript = scriptId => {
Expand All @@ -46,7 +50,8 @@ class SectionAssessments extends Component {
};

render() {
const {validScripts, scriptId, assessmentList, assessmentId, isLoading} = this.props;
const {validScripts, scriptId, assessmentList, assessmentId,
isLoading, isCurrentAssessmentSurvey, totalStudentSubmissions} = this.props;

return (
<div>
Expand Down Expand Up @@ -75,13 +80,35 @@ class SectionAssessments extends Component {
{!isLoading &&
<div>
{/* Assessments */}
<MCAssessmentsOverviewContainer />
<StudentsMCSummaryContainer />
<MultipleChoiceByStudentContainer />
<FreeResponsesAssessmentsContainer />
{!isCurrentAssessmentSurvey &&
<div>
{totalStudentSubmissions > 0 &&
<div>
<MCAssessmentsOverviewContainer />
<StudentsMCSummaryContainer />
<MultipleChoiceByStudentContainer />
<FreeResponsesAssessmentsContainer />
</div>
}
{totalStudentSubmissions <= 0 &&
<h3>{i18n.emptyAssessmentSubmissions()}</h3>
}
</div>
}
{/* Surveys */}
<MCSurveyOverviewContainer />
<FreeResponseBySurveyQuestionContainer />
{isCurrentAssessmentSurvey &&
<div>
{totalStudentSubmissions > 0 &&
<div>
<MCSurveyOverviewContainer />
<FreeResponseBySurveyQuestionContainer />
</div>
}
{totalStudentSubmissions <=0 &&
<h3>{i18n.emptySurveyOverviewTable()}</h3>
}
</div>
}
</div>
}
{isLoading &&
Expand All @@ -101,6 +128,8 @@ export default connect(state => ({
assessmentList: getCurrentScriptAssessmentList(state),
scriptId: state.scriptSelection.scriptId,
assessmentId: state.sectionAssessments.assessmentId,
isCurrentAssessmentSurvey: isCurrentAssessmentSurvey(state),
totalStudentSubmissions: countSubmissionsForCurrentAssessment(state),
}), dispatch => ({
setScriptId(scriptId) {
dispatch(setScriptId(scriptId));
Expand Down
16 changes: 13 additions & 3 deletions apps/src/templates/sectionAssessments/sectionAssessmentsRedux.js
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,16 @@ export const getMultipleChoiceSurveyResults = (state) => {
});
};

// Returns a boolean. The selector function checks if the current assessment Id
// is in the surveys structure.
export const isCurrentAssessmentSurvey = (state) => {
const scriptId = state.scriptSelection.scriptId;
const surveysStructure = state.sectionAssessments.surveysByScript[scriptId] || {};

const currentAssessmentId = state.sectionAssessments.assessmentId;
return Object.keys(surveysStructure).includes(currentAssessmentId.toString());
};

/** Get data for students assessments multiple choice table
* Returns an object, each of type studentOverviewDataPropType with
* the value of the key being an object that contains the number
Expand Down Expand Up @@ -467,13 +477,13 @@ export const getMultipleChoiceSectionSummary = (state) => {
};

/**
* Selector function that takes in the state and a boolean indicating
* if the current assessment is a survey.
* Selector function that takes in the state.
* @returns {number} total count of students who have submitted
* the current assessment.
*/
export const countSubmissionsForCurrentAssessment = (state, isSurvey) => {
export const countSubmissionsForCurrentAssessment = (state) => {
const currentAssessmentId = state.sectionAssessments.assessmentId;
const isSurvey = isCurrentAssessmentSurvey(state);
if (isSurvey) {
const surveysStructure = state.sectionAssessments.surveysByScript[state.scriptSelection.scriptId] || {};
const currentSurvey = surveysStructure[currentAssessmentId];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import sectionAssessments, {
getCorrectAnswer,
indexesToAnswerString,
countSubmissionsForCurrentAssessment,
isCurrentAssessmentSurvey,
} from '@cdo/apps/templates/sectionAssessments/sectionAssessmentsRedux';
import {setSection} from '@cdo/apps/redux/sectionDataRedux';

Expand Down Expand Up @@ -391,6 +392,42 @@ describe('sectionAssessmentsRedux', () => {
});
});

describe('isCurrentAssessmentSurvey', () => {
it('returns true when the current assessment is a survey', () => {
const stateWithSurvey = {
...rootState,
sectionAssessments: {
...rootState.sectionAssessments,
assessmentId: 123,
surveysByScript: {
3: {
123: {}
}
}
}
};
const result = isCurrentAssessmentSurvey(stateWithSurvey);
assert.deepEqual(result, true);
});

it('returns false when the current assessment is not a survey', () => {
const stateWithSurvey = {
...rootState,
sectionAssessments: {
...rootState.sectionAssessments,
assessmentId: 123,
surveysByScript: {
3: {
234: {}
}
}
}
};
const result = isCurrentAssessmentSurvey(stateWithSurvey);
assert.deepEqual(result, false);
});
});

describe('getMultipleChoiceSectionSummary', () => {
it('returns an empty array when no assessments in redux', () => {
const result = getMultipleChoiceSectionSummary(rootState);
Expand Down Expand Up @@ -575,7 +612,7 @@ describe('sectionAssessmentsRedux', () => {
}
};

const totalSubmissions = countSubmissionsForCurrentAssessment(stateWithAssessment, false);
const totalSubmissions = countSubmissionsForCurrentAssessment(stateWithAssessment);
assert.deepEqual(totalSubmissions, 2);
});

Expand Down Expand Up @@ -611,7 +648,7 @@ describe('sectionAssessmentsRedux', () => {
}
};

const totalSubmissions = countSubmissionsForCurrentAssessment(stateWithSurvey, true);
const totalSubmissions = countSubmissionsForCurrentAssessment(stateWithSurvey);
assert.deepEqual(totalSubmissions, 1);
});
});
Expand Down
6 changes: 3 additions & 3 deletions apps/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
version "0.2.1"
resolved "https://registry.yarnpkg.com/@code-dot-org/artist/-/artist-0.2.1.tgz#fcfe7ea5cfb3f19ddb6b912e70e922ba4b7ef0b1"

"@code-dot-org/blockly@2.4.1":
version "2.4.1"
resolved "https://registry.yarnpkg.com/@code-dot-org/blockly/-/blockly-2.4.1.tgz#46a979f1e7c8616ab21d006985ca81cc8a2388cb"
"@code-dot-org/blockly@2.4.2":
version "2.4.2"
resolved "https://registry.yarnpkg.com/@code-dot-org/blockly/-/blockly-2.4.2.tgz#83ac8c7904274972e1f7ba57cda308e544e095a7"

"@code-dot-org/bramble@0.1.26":
version "0.1.26"
Expand Down
4 changes: 2 additions & 2 deletions dashboard/app/controllers/registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ def set_email
false
elsif needs_password?(current_user, params)
if current_user.valid_password?(params[:user][:current_password])
current_user.update_primary_authentication_option(user: set_email_params)
current_user.update_primary_contact_info(user: set_email_params)
else
false
end
else
current_user.update_primary_authentication_option(user: set_email_params)
current_user.update_primary_contact_info(user: set_email_params)
end
else
if forbidden_change?(current_user, params)
Expand Down