Last active
November 8, 2018 10:01
-
-
Save trickydisco78/13d4bd010782dfb22ccac45e1e947443 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function buildSearchQuery(year,courseType,keyword) { | |
const searchOptions = { | |
undergraduate: `?query=${keyword}&sort=score&dir=desc&sort=UndergraduateCourse-programname&dir=asc&filter%3AUndergraduateCourse-year=${year}`, | |
postgraduate: `?query=${keyword}&sort=score&dir=desc&sort=PostgraduateCourse-programtype&dir=asc&sort=PostgraduateCourse-programname&dir=asc${year}`, | |
} | |
return searchOptions[courseType] | |
} | |
function buildURLPath(courseType) { | |
const courseUrl = { | |
undergraduate: `'/undergraduate/search/search_results/`, | |
postgraduate: `'/postgraduate/search/search_results/`, | |
}; | |
return courseUrl[courseType] | |
} | |
function buildFullSearchURL (year, courseType, keyword) { | |
return buildURLPath(courseType) + buildSearchQuery(year,courseType,keyword) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment