Skip to content

Commit

Permalink
Merge pull request #33508 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 Mar 9, 2020
2 parents 15bf4a8 + 1e1512a commit a210e8d
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 59 deletions.
34 changes: 5 additions & 29 deletions apps/src/templates/sectionProgress/SectionProgress.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ import {stageIsAllAssessment} from '@cdo/apps/templates/progress/progressHelpers
import firehoseClient from '../../lib/util/firehose';
import experiments from '@cdo/apps/util/experiments';
import ProgressViewHeader from './ProgressViewHeader';
import {
fetchStandardsCoveredForScript,
fetchStudentLevelScores
} from '@cdo/apps/templates/sectionProgress/standards/sectionStandardsProgressRedux';

const styles = {
heading: {
Expand Down Expand Up @@ -82,20 +78,11 @@ class SectionProgress extends Component {
setScriptId: PropTypes.func.isRequired,
setLessonOfInterest: PropTypes.func.isRequired,
isLoadingProgress: PropTypes.bool.isRequired,
showStandardsIntroDialog: PropTypes.bool,
fetchStandardsCoveredForScript: PropTypes.func.isRequired,
fetchStudentLevelScores: PropTypes.func.isRequired
showStandardsIntroDialog: PropTypes.bool
};

componentDidMount() {
this.props.loadScript(this.props.scriptId);
if (experiments.isEnabled(experiments.STANDARDS_REPORT)) {
this.props.fetchStandardsCoveredForScript(this.props.scriptId);
this.props.fetchStudentLevelScores(
this.props.scriptId,
this.props.section.id
);
}
this.props.loadScript(this.props.scriptId, this.props.section.id);
}

componentDidUpdate() {
Expand All @@ -111,12 +98,7 @@ class SectionProgress extends Component {

onChangeScript = scriptId => {
this.props.setScriptId(scriptId);
this.props.loadScript(scriptId);
this.props.fetchStandardsCoveredForScript(scriptId);
this.props.fetchStudentLevelScores(
this.props.scriptId,
this.props.section.id
);
this.props.loadScript(scriptId, this.props.section.id);

firehoseClient.putRecord(
{
Expand Down Expand Up @@ -278,8 +260,8 @@ export default connect(
showStandardsIntroDialog: !state.currentUser.hasSeenStandardsReportInfo
}),
dispatch => ({
loadScript(scriptId) {
dispatch(loadScript(scriptId));
loadScript(scriptId, sectionId) {
dispatch(loadScript(scriptId, sectionId));
},
setScriptId(scriptId) {
dispatch(setScriptId(scriptId));
Expand All @@ -289,12 +271,6 @@ export default connect(
},
setCurrentView(viewType) {
dispatch(setCurrentView(viewType));
},
fetchStandardsCoveredForScript(scriptId) {
dispatch(fetchStandardsCoveredForScript(scriptId));
},
fetchStudentLevelScores(scriptId, sectionId) {
dispatch(fetchStudentLevelScores(scriptId, sectionId));
}
})
)(SectionProgress);
15 changes: 14 additions & 1 deletion apps/src/templates/sectionProgress/sectionProgressRedux.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ import _ from 'lodash';
import {SET_SCRIPT} from '@cdo/apps/redux/scriptSelectionRedux';
import {SET_SECTION} from '@cdo/apps/redux/sectionDataRedux';
import firehoseClient from '../../lib/util/firehose';
import experiments from '@cdo/apps/util/experiments';
import {
fetchStandardsCoveredForScript,
fetchStudentLevelScores
} from '@cdo/apps/templates/sectionProgress/standards/sectionStandardsProgressRedux';

const SET_CURRENT_VIEW = 'sectionProgress/SET_CURRENT_VIEW';
const SET_LESSON_OF_INTEREST = 'sectionProgress/SET_LESSON_OF_INTEREST';
Expand Down Expand Up @@ -338,8 +343,9 @@ export const getColumnWidthsForDetailView = state => {
* Query the server for script data (info about the levels in the script) and
* also for user progress on that script
* @param {string} scriptId to load data for
* @param {string} sectionId to load data for
*/
export const loadScript = scriptId => {
export const loadScript = (scriptId, sectionId) => {
return (dispatch, getState) => {
const state = getState().sectionProgress;
const sectionData = getState().sectionData.section;
Expand All @@ -359,6 +365,13 @@ export const loadScript = scriptId => {
.then(response => response.json())
.then(scriptData => {
dispatch(addScriptData(scriptId, scriptData));
if (
scriptData.hasStandards &&
experiments.isEnabled(experiments.STANDARDS_REPORT)
) {
dispatch(fetchStandardsCoveredForScript(scriptId));
dispatch(fetchStudentLevelScores(scriptId, sectionId));
}
});

const numStudents = sectionData.students.length;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,17 @@ const styles = {
display: 'flex',
flexDirection: 'row'
},
lessonBoxes: {
display: 'flex',
flexDirection: 'row',
flexWrap: 'wrap'
},
lessonBox: {
marginBottom: 10
},
lessonsAreaTitle: {
marginRight: 10,
width: '28%'
width: '30%'
},
tooltip: {
textAlign: 'center'
Expand All @@ -40,7 +48,7 @@ class StandardDescriptionCell extends Component {
if (this.props.lessonsForStandardStatus) {
return this.props.lessonsForStandardStatus.map((lesson, index) => {
return (
<span key={lesson.name}>
<span key={lesson.name} style={styles.lessonBox}>
{!this.props.isViewingReport && (
<ReactTooltip
id={lesson.name}
Expand Down Expand Up @@ -95,7 +103,7 @@ class StandardDescriptionCell extends Component {
<span style={styles.lessonsAreaTitle}>
{i18n.availableLessons({numLessons: this.getNumberLessons()})}
</span>
{this.getLessonBoxes()}
<div style={styles.lessonBoxes}>{this.getLessonBoxes()}</div>
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ const styles = {
textAlign: 'center'
},
descriptionCell: {
maxWidth: 470
maxWidth: 470,
padding: '10px 10px 0px 10px'
}
};

Expand Down
22 changes: 4 additions & 18 deletions apps/src/templates/sectionProgress/standards/StandardsReport.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ import {loadScript} from '../sectionProgressRedux';
import PrintReportButton from './PrintReportButton';
import {cstaStandardsURL} from './standardsConstants';
import FontAwesome from '@cdo/apps/templates/FontAwesome';
import {
fetchStandardsCoveredForScript,
fetchStudentLevelScores
} from '@cdo/apps/templates/sectionProgress/standards/sectionStandardsProgressRedux';

const styles = {
printView: {
Expand Down Expand Up @@ -78,11 +74,9 @@ class StandardsReport extends Component {
numStudentsInSection: PropTypes.number,
numLessonsCompleted: PropTypes.number,
numLessonsInUnit: PropTypes.number,
fetchStandardsCoveredForScript: PropTypes.func.isRequired,
setTeacherCommentForReport: PropTypes.func.isRequired,
setScriptId: PropTypes.func.isRequired,
lessonsByStandard: PropTypes.object,
fetchStudentLevelScores: PropTypes.func.isRequired
lessonsByStandard: PropTypes.object
};

componentDidMount() {
Expand All @@ -92,9 +86,7 @@ class StandardsReport extends Component {
const scriptIdFromTD =
window.opener.teacherDashboardStoreInformation.scriptId;
this.props.setScriptId(scriptIdFromTD);
this.props.loadScript(scriptIdFromTD);
this.props.fetchStandardsCoveredForScript(scriptIdFromTD);
this.props.fetchStudentLevelScores(scriptIdFromTD, this.props.section.id);
this.props.loadScript(scriptIdFromTD, this.props.section.id);
}

getLinkToOverview() {
Expand Down Expand Up @@ -232,14 +224,8 @@ export default connect(
lessonsByStandard: lessonsByStandard(state)
}),
dispatch => ({
loadScript(scriptId) {
dispatch(loadScript(scriptId));
},
fetchStandardsCoveredForScript(scriptId) {
dispatch(fetchStandardsCoveredForScript(scriptId));
},
fetchStudentLevelScores(scriptId, sectionId) {
dispatch(fetchStudentLevelScores(scriptId, sectionId));
loadScript(scriptId, sectionId) {
dispatch(loadScript(scriptId, sectionId));
},
setTeacherCommentForReport(comment) {
dispatch(setTeacherCommentForReport(comment));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ describe('SectionProgress', () => {
},
isLoadingProgress: false,
scriptFriendlyName: 'My Script',
showStandardsIntroDialog: false,
fetchStandardsCoveredForScript: () => {},
fetchStudentLevelScores: () => {}
showStandardsIntroDialog: false
};
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ describe('StandardsReport', () => {
numStudentsInSection: 15,
numLessonsCompleted: 5,
numLessonsInUnit: 10,
fetchStandardsCoveredForScript: () => {},
fetchStudentLevelScores: () => {},
setTeacherCommentForReport: comment => {
DEFAULT_PROPS.teacherComment = comment;
},
Expand Down
26 changes: 24 additions & 2 deletions shared/css/standards-report-print.css

Large diffs are not rendered by default.

0 comments on commit a210e8d

Please sign in to comment.