From ba3c14c83b11d80d994875c0d80753f0bb7e0e98 Mon Sep 17 00:00:00 2001 From: RohitGarudadri Date: Fri, 3 Jan 2020 14:13:52 -0500 Subject: [PATCH 1/5] Pull develop --- docs/CHANGELOG.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index d1fb230ce..895196a5b 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -10,10 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Fixed where background image renders on status page -<<<<<<< HEAD - Fixed close date to be midnight instead of noon -======= ->>>>>>> develop ## [2.2.0](https://github.com/hackmcgill/dashboard/tree/2.2.0) - 2020-01-01 From d9cac55322587777c9802c96a1191cc14dc3f65b Mon Sep 17 00:00:00 2001 From: RohitGarudadri Date: Sun, 12 Jan 2020 13:01:58 -0500 Subject: [PATCH 2/5] fixed search results for search page --- docs/CHANGELOG.md | 6 ++++++ src/features/Search/Search.tsx | 9 +++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 46b703952..861275331 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +### Fixed + +- Fixed search page not loading properly + ## [2.2.2](https://github.com/hackmcgill/dashboard/tree/2.2.2) - 2020-01-05 ### Changed diff --git a/src/features/Search/Search.tsx b/src/features/Search/Search.tsx index a3a8fbe5f..e3f97ccb6 100644 --- a/src/features/Search/Search.tsx +++ b/src/features/Search/Search.tsx @@ -278,13 +278,14 @@ class SearchContainer extends React.Component<{}, ISearchState> { } else { foundAcct = accountId.includes(searchBar); } - const foundHacker = hacker.id.includes(searchBar) || - hacker.fieldOfStudy.includes(searchBar) || - hacker.school.includes(searchBar) || + hacker.application.general.fieldOfStudy.includes(searchBar) || + hacker.application.general.school.includes(searchBar) || hacker.status.includes(searchBar) || - hacker.graduationYear.toString().includes(searchBar); + hacker.application.general.graduationYear + .toString() + .includes(searchBar); const isSavedBySponsorIfToggled = !viewSaved || From 423ba1d9a73f0a110cead281b0c330af6abf0908 Mon Sep 17 00:00:00 2001 From: RohitGarudadri Date: Sun, 12 Jan 2020 18:59:22 -0500 Subject: [PATCH 3/5] Sponsor searching improved --- src/features/Search/Filters.tsx | 30 +++++++++++++++------- src/features/Search/ResultsTable.tsx | 37 ++++++++++++++++++++++------ src/features/Search/Search.tsx | 21 ++++++++-------- 3 files changed, 62 insertions(+), 26 deletions(-) diff --git a/src/features/Search/Filters.tsx b/src/features/Search/Filters.tsx index 6fc86b565..55ebec18b 100644 --- a/src/features/Search/Filters.tsx +++ b/src/features/Search/Filters.tsx @@ -45,11 +45,17 @@ class FilterComponent extends React.Component { } private parseInitialValues(initFilters: ISearchParameter[]) { const initVals = { - school: this.searchParam2List('school', initFilters), - gradYear: this.searchParam2List('graduationYear', initFilters), - degree: this.searchParam2List('degree', initFilters), + school: this.searchParam2List('application.general.school', initFilters), + gradYear: this.searchParam2List( + 'application.general.graduationYear', + initFilters + ), + degree: this.searchParam2List('application.general.degree', initFilters), status: this.searchParam2List('status', initFilters), - skills: this.searchParam2List('application.skills', initFilters), + skills: this.searchParam2List( + 'application.shortAnswer.skills', + initFilters + ), jobInterest: this.searchParam2List( 'application.general.jobInterest', initFilters @@ -154,19 +160,25 @@ class FilterComponent extends React.Component { * @param values Formik values */ private handleSubmit(values: FormikValues) { - const schoolSearchParam = this.list2SearchParam('school', values.school); + const schoolSearchParam = this.list2SearchParam( + 'application.general.school', + values.school + ); const gradYearParam = this.list2SearchParam( - 'graduationYear', + 'application.general.graduationYear', values.gradYear ); - const degreeParam = this.list2SearchParam('degree', values.degree); + const degreeParam = this.list2SearchParam( + 'application.general.degree', + values.degree + ); const statusParam = this.list2SearchParam('status', values.status); const skillsParam = this.list2SearchParam( - 'application.skills', + 'application.shortAnswer.skills', values.skills ); const jobInterestParam = this.list2SearchParam( - 'application.jobInterest', + 'application.general.jobInterest', values.jobInterest ); let search: ISearchParameter[] = []; diff --git a/src/features/Search/ResultsTable.tsx b/src/features/Search/ResultsTable.tsx index 371816273..96519ab0c 100644 --- a/src/features/Search/ResultsTable.tsx +++ b/src/features/Search/ResultsTable.tsx @@ -22,8 +22,7 @@ const ResultsTable: React.StatelessComponent = (props) => { accessor: 'hacker.accountId.firstName', }, ]; - - const adminColumns = [ + const generalColumns = [ ...volunteerColumns, { Header: 'Last Name', @@ -31,20 +30,28 @@ const ResultsTable: React.StatelessComponent = (props) => { }, { Header: 'School', - accessor: 'hacker.school', + accessor: 'hacker.application.general.school', }, { - Header: 'Major', - accessor: 'hacker.major', + Header: 'Field of Study', + accessor: 'hacker.application.general.fieldOfStudy', }, { Header: 'Grad Year', - accessor: 'hacker.graduationYear', + accessor: 'hacker.application.general.graduationYear', }, + ]; + + const adminColumns = [ + ...generalColumns, { Header: 'Status', accessor: 'hacker.status', }, + { + Header: 'Job Interest', + accessor: 'hacker.application.general.jobInterest', + }, { Header: 'Applicant Info', Cell: ({ original }: any) => ( @@ -60,7 +67,23 @@ const ResultsTable: React.StatelessComponent = (props) => { ]; const sponsorColumns = [ - ...adminColumns, + ...generalColumns, + { + Header: 'Job Interest', + accessor: 'hacker.application.general.jobInterest', + }, + { + Header: 'Applicant Info', + Cell: ({ original }: any) => ( +
+ r.hacker)} + userType={props.userType} + /> +
+ ), + }, { Header: 'Save', Cell: ({ original }: any) => ( diff --git a/src/features/Search/Search.tsx b/src/features/Search/Search.tsx index e3f97ccb6..5ef03e3e3 100644 --- a/src/features/Search/Search.tsx +++ b/src/features/Search/Search.tsx @@ -142,10 +142,7 @@ class SearchContainer extends React.Component<{}, ISearchState> { const sponsor = (await Sponsor.getSelf()).data.data; this.setState({ sponsor }); } - - if (this.state.query.length > 0 || this.state.searchBar.length > 0) { - this.triggerSearch(); - } + await this.triggerSearch(); } private getSearchFromQuery(): ISearchParameter[] { const search = getValueFromQuery('q'); @@ -260,20 +257,22 @@ class SearchContainer extends React.Component<{}, ISearchState> { } private filter() { - const { sponsor, viewSaved, results, searchBar } = this.state; - + const { sponsor, viewSaved, results } = this.state; + const searchBar = this.state.searchBar.toLowerCase(); return results.filter(({ hacker }) => { const { accountId } = hacker; let foundAcct; if (typeof accountId !== 'string') { const account = accountId as IAccount; - const fullName = `${account.firstName} ${account.lastName}`; + const fullName = `${account.firstName} ${ + account.lastName + }`.toLowerCase(); foundAcct = fullName.includes(searchBar) || - account.email.includes(searchBar) || + account.email.toLowerCase().includes(searchBar) || account.phoneNumber.toString().includes(searchBar) || // Removed as shirt size is no longer a properity of account: account.shirtSize.includes(searchBar) || - account.gender.includes(searchBar) || + account.gender.toLowerCase().includes(searchBar) || (account._id && account._id.includes(searchBar)); } else { foundAcct = accountId.includes(searchBar); @@ -285,7 +284,9 @@ class SearchContainer extends React.Component<{}, ISearchState> { hacker.status.includes(searchBar) || hacker.application.general.graduationYear .toString() - .includes(searchBar); + .includes(searchBar) || + hacker.application.general.jobInterest.includes(searchBar); //|| + // hackera; const isSavedBySponsorIfToggled = !viewSaved || From 470f98dac44f1f8dbe8621fb74e6189c049182bf Mon Sep 17 00:00:00 2001 From: RohitGarudadri Date: Sun, 12 Jan 2020 22:54:01 -0500 Subject: [PATCH 4/5] Added fields and improved search functionality for search page --- docs/CHANGELOG.md | 6 ++++++ src/features/Search/Search.tsx | 24 +++++++++++++++--------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 861275331..3d0300835 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -7,9 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +### Added + +- Job interest column for sponsors to see more info on hacker + ### Fixed - Fixed search page not loading properly +- Fixed search queries not working +- Update saved hackers for sponsors to view without refreshing page ## [2.2.2](https://github.com/hackmcgill/dashboard/tree/2.2.2) - 2020-01-05 diff --git a/src/features/Search/Search.tsx b/src/features/Search/Search.tsx index 5ef03e3e3..57436f8dd 100644 --- a/src/features/Search/Search.tsx +++ b/src/features/Search/Search.tsx @@ -271,7 +271,6 @@ class SearchContainer extends React.Component<{}, ISearchState> { fullName.includes(searchBar) || account.email.toLowerCase().includes(searchBar) || account.phoneNumber.toString().includes(searchBar) || - // Removed as shirt size is no longer a properity of account: account.shirtSize.includes(searchBar) || account.gender.toLowerCase().includes(searchBar) || (account._id && account._id.includes(searchBar)); } else { @@ -279,14 +278,19 @@ class SearchContainer extends React.Component<{}, ISearchState> { } const foundHacker = hacker.id.includes(searchBar) || - hacker.application.general.fieldOfStudy.includes(searchBar) || hacker.application.general.school.includes(searchBar) || - hacker.status.includes(searchBar) || + hacker.application.general.degree.includes(searchBar) || + hacker.application.general.fieldOfStudy.includes(searchBar) || hacker.application.general.graduationYear .toString() .includes(searchBar) || - hacker.application.general.jobInterest.includes(searchBar); //|| - // hackera; + hacker.application.general.jobInterest.includes(searchBar) || + hacker.status.includes(searchBar) || + hacker.application.shortAnswer.question1.includes(searchBar) || + hacker.application.shortAnswer.question2.includes(searchBar) || + hacker.application.accommodation.shirtSize.includes(searchBar) || + (hacker.application.shortAnswer.skills && + hacker.application.shortAnswer.skills.toString().includes(searchBar)); const isSavedBySponsorIfToggled = !viewSaved || @@ -296,12 +300,14 @@ class SearchContainer extends React.Component<{}, ISearchState> { }); } - private toggleSaved = () => { - const { sponsor, viewSaved } = this.state; + private async toggleSaved() { + const viewSaved = this.state.viewSaved; + // Resets the sponsor if they made changes to their saved hackers + const sponsor = (await Sponsor.getSelf()).data.data; if (sponsor) { - this.setState({ viewSaved: !viewSaved }); + this.setState({ sponsor, viewSaved: !viewSaved }); } - }; + } } export default withContext(WithToasterContainer(SearchContainer)); From ec5540cc49654b80a38424cae66a34ced90715ba Mon Sep 17 00:00:00 2001 From: RohitGarudadri Date: Sun, 12 Jan 2020 23:02:39 -0500 Subject: [PATCH 5/5] Fixed async function --- src/features/Search/Search.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/features/Search/Search.tsx b/src/features/Search/Search.tsx index 57436f8dd..5741bfaa4 100644 --- a/src/features/Search/Search.tsx +++ b/src/features/Search/Search.tsx @@ -300,14 +300,14 @@ class SearchContainer extends React.Component<{}, ISearchState> { }); } - private async toggleSaved() { - const viewSaved = this.state.viewSaved; + private toggleSaved = async () => { // Resets the sponsor if they made changes to their saved hackers const sponsor = (await Sponsor.getSelf()).data.data; + const { viewSaved } = this.state; if (sponsor) { this.setState({ sponsor, viewSaved: !viewSaved }); } - } + }; } export default withContext(WithToasterContainer(SearchContainer));