Skip to content

Commit c48db79

Browse files
committed
WB-1969 Tweak user name extraction
1 parent 090cf70 commit c48db79

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/main/java/org/ecocean/MetricsBot.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,9 +437,10 @@ private static void addTasksToCsv(ArrayList<String> csvLines, String context) th
437437
String normalizedName = stripAccents(name);
438438
int spaceIndex = normalizedName.indexOf(" ");
439439
name = (normalizedName.substring(0,spaceIndex) + "_" + normalizedName.charAt(spaceIndex+1)).toLowerCase();
440-
System.out.println("NAME:" + name);
441-
442440
}
441+
name+="_"+user.getUUID().substring(0,8);
442+
name=name.replaceAll("-", "_");
443+
System.out.println("NAME:" + name);
443444
csvLines.add(buildGauge("SELECT count(this) FROM org.ecocean.ia.Task where parameters.indexOf(" + "'" + userFilter + "'" + ") > -1 && (parameters.indexOf('ibeis.identification') > -1 || parameters.indexOf('pipeline_root') > -1 || parameters.indexOf('graph') > -1)","wildbook_user_tasks_"+name, "Number of tasks from user " + name, context));
444445
}
445446
catch (NullPointerException e) { }
@@ -456,7 +457,7 @@ public static String stripAccents(String input){
456457
return input == null ? null :
457458
Normalizer.normalize(input, Normalizer.Form.NFD)
458459
.replaceAll("\\p{InCombiningDiacriticalMarks}+", "");
459-
}
460+
}
460461

461462

462463
public static String httpGetRemoteText(String url) {

0 commit comments

Comments
 (0)