refactor: add logging info to search members

This commit is contained in:
Jordan Knott 2020-10-20 18:59:09 -05:00
parent 0a48b578fd
commit 451581e934

View File

@ -1215,6 +1215,7 @@ func (r *queryResolver) Notifications(ctx context.Context) ([]db.Notification, e
func (r *queryResolver) SearchMembers(ctx context.Context, input MemberSearchFilter) ([]MemberSearchResult, error) { func (r *queryResolver) SearchMembers(ctx context.Context, input MemberSearchFilter) ([]MemberSearchResult, error) {
availableMembers, err := r.Repository.GetMemberData(ctx, *input.ProjectID) availableMembers, err := r.Repository.GetMemberData(ctx, *input.ProjectID)
if err != nil { if err != nil {
logger.New(ctx).WithField("projectID", input.ProjectID).WithError(err).Error("error while getting member data")
return []MemberSearchResult{}, err return []MemberSearchResult{}, err
} }
@ -1226,6 +1227,7 @@ func (r *queryResolver) SearchMembers(ctx context.Context, input MemberSearchFil
masterList[member.Username] = member.UserID masterList[member.Username] = member.UserID
masterList[member.Email] = member.UserID masterList[member.Email] = member.UserID
} }
logger.New(ctx).Info("fuzzy rank finder")
rankedList := fuzzy.RankFind(input.SearchFilter, sortList) rankedList := fuzzy.RankFind(input.SearchFilter, sortList)
results := []MemberSearchResult{} results := []MemberSearchResult{}
memberList := map[uuid.UUID]bool{} memberList := map[uuid.UUID]bool{}