Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fixed search #242

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
12 changes: 10 additions & 2 deletions controllers/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,16 @@ func (u *UserController) Search() {
c = 500
}
path := u.GetString("path")
//TODO (nano): check for path to be one of the only pausible paths
if path == "" {
//Checking for possible fields, default is "username"
var possible_path []string
var good_path bool = false
possible_path = []string{"username", "fullname", "handle.codechef", "handle.codeforces", "handle.hackerearth", "handle.hackerrank", "handle.spoj"}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-check the list of platforms. Leetcode is missing and hackerearth is extra.

for _, itr := range possible_path {
if itr == path {
good_path = true
}
}
if good_path == false {
path = "username"
}
results, err := models.SearchUser(query, c, path)
Expand Down