Skip to content

Commit

Permalink
Merge pull request #163 from khoa-nd/master
Browse files Browse the repository at this point in the history
Merged
  • Loading branch information
khoa-nd committed Feb 6, 2015
2 parents 595655b + 4f9bd14 commit cd673a4
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ private void processUserEmail(UserImportData user) {
}

private void extractUserSkillSetFromDescription(UserImportData user) {
if (StringUtils.isNotEmpty(user.getDescription())) {
if (StringUtils.isNotEmpty(user.getDescription()) && !StringUtils.contains(user.getDescription(), "available")) {
final String USER_DESCRIPTION_PATTERN = "([A-Za-z0-9-_]+)*\\shas\\s([0-9]+)*\\s(repositories|repository)\\swritten\\sin\\s"
+ "(([-\\w\\s,\\+#\\(\\)']+)*|([-\\w\\s,\\+#\\(\\)']+)*\\sand\\s([-\\w\\+#\\(\\)']+)*)\\.\\s"
+ "Follow\\stheir\\scode\\son\\sGitHub\\.";
Pattern pattern = Pattern.compile(USER_DESCRIPTION_PATTERN);
Matcher matcher = pattern.matcher(user.getDescription());
if (matcher.matches()) {
user.setNumberOfRepositories(Integer.valueOf(matcher.group(2)));
String skills = matcher.group(4).replaceAll("and", EmailValidator.COMMA).replaceAll("available", "");
String skills = matcher.group(4).replaceAll("and", EmailValidator.COMMA);
user.setSkills(Arrays.asList(StringUtils.split(StringUtils.deleteWhitespace(skills), EmailValidator.COMMA)));
}
}
Expand Down

0 comments on commit cd673a4

Please sign in to comment.