Skip to content

Commit

Permalink
Merge pull request #1118 from UniversityOfHelsinkiCS/trunk
Browse files Browse the repository at this point in the history
shameful pull request
  • Loading branch information
esakemp authored Jul 15, 2019
2 parents b34d04b + 1900c6f commit 078217d
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -385,9 +385,17 @@ class PopulationSearchForm extends Component {

getMinSelection = (startYear, semester) => (semester === 'FALL' ? `${startYear}-08-01` : `${startYear}-01-01`)

checkPreviousQuery = (query, previousQuery) => {
const sameProgramme = query.studyRights.programme === previousQuery.studyRights.programme
const sameMonths = query.months === previousQuery.months
const sameStartYear = query.startYear === previousQuery.startYear
return sameProgramme && sameMonths && sameStartYear
}

fetchPopulationFromUrlParams() {
const previousQuery = this.props.queries
const query = this.parseQueryFromUrl()
if (query.fetch && query !== this.state.query) {
if (query.fetch || !this.checkPreviousQuery(query, previousQuery)) {
this.setState({ query })
this.fetchPopulation(query)
}
Expand Down

0 comments on commit 078217d

Please sign in to comment.