diff --git a/frontend/src/views/ProgressOverview.js b/frontend/src/views/ProgressOverview.js index 3157dd82..96400987 100644 --- a/frontend/src/views/ProgressOverview.js +++ b/frontend/src/views/ProgressOverview.js @@ -32,6 +32,7 @@ class ProgressOverview extends Component { ordering: 'profile__name', selectedCourseIds: '', csvExportProgress: 0, + wideView: false, }; this.fetchFullViewData = this.fetchFullViewData.bind(this); this.getUsersForCsv = this.getUsersForCsv.bind(this); @@ -68,7 +69,10 @@ class ProgressOverview extends Component { const coursesFilterOptions = courses.map((course, index) => { const entry = { id: course.id, - name: course.name + label: `${course.name} | ${course.number} | ${course.id}`, + name: course.name, + number: course.number, + id: course.id, } return ( entry @@ -99,7 +103,7 @@ class ProgressOverview extends Component { this.setState({ perPage: newValue, }, () => { - this.getUsers(); + (this.state.selectedCourses.length || this.state.searchQuery) && this.getUsers(); }) } @@ -107,7 +111,7 @@ class ProgressOverview extends Component { this.setState({ searchQuery: newValue }, () => { - this.getUsers(); + (this.state.selectedCourses.length || this.state.searchQuery) && this.getUsers(); }) } @@ -115,7 +119,7 @@ class ProgressOverview extends Component { this.setState({ ordering: newValue }, () => { - this.getUsers(); + (this.state.selectedCourses.length || this.state.searchQuery) && this.getUsers(); }) } @@ -128,7 +132,7 @@ class ProgressOverview extends Component { selectedCourses: selectedList, selectedCourseIds: selectedCourseIds, }, () => { - this.getUsers(); + (this.state.selectedCourses.length || this.state.searchQuery) && this.getUsers(); }) } @@ -194,7 +198,14 @@ class ProgressOverview extends Component { coursesFilter.forEach((course, i) => { const userProgress = userCoursesImmutable.find(singleCourse => singleCourse.get('course_id') === course.id); if (userProgress) { - singleRecord[course.id] = `Progress: ${userProgress.getIn(['progress_percent'])}/1 | Sections: ${userProgress.getIn(['progress_details', 'sections_worked'])}/${userProgress.getIn(['progress_details', 'sections_possible'])} | Points: ${userProgress.getIn(['progress_details', 'points_earned'])}/${userProgress.getIn(['progress_details', 'points_possible'])}`; + + const progressPercent = (userProgress.getIn(['progress_percent'])) ? userProgress.getIn(['progress_percent']).toFixed(2) : '-'; + const sectionsWorked = (userProgress.getIn(['progress_details', 'sections_worked'])) ? userProgress.getIn(['progress_details', 'sections_worked']).toFixed(1) : '-'; + const sectionsPossible = (userProgress.getIn(['progress_details', 'sections_possible'])) ? userProgress.getIn(['progress_details', 'sections_possible']).toFixed(1) : '-'; + const pointsEarned = (userProgress.getIn(['progress_details', 'points_earned'])) ? userProgress.getIn(['progress_details', 'points_earned']).toFixed(1) : '-'; + const pointsPossible = (userProgress.getIn(['progress_details', 'points_possible'])) ? userProgress.getIn(['progress_details', 'points_possible']).toFixed(1) : '-'; + + singleRecord[course.id] = `Progress: ${progressPercent}/1 | Sections: ${sectionsWorked}/${sectionsPossible} | Points: ${pointsEarned}/${pointsPossible}`; } else { singleRecord[course.id] = '-'; }; @@ -204,9 +215,14 @@ class ProgressOverview extends Component { return csvTestVar; } + toggleWideView = () => { + this.setState({ + wideView: !this.state.wideView + }) + } + componentDidMount() { this.getCourses(); - this.getUsers(); } render() { @@ -215,8 +231,13 @@ class ProgressOverview extends Component { const headerCourseColumns = coursesFilter.map((course, index) => { return( -