diff --git a/appointment-import/src/main/java/smash/appointment/parse/AppointmentType.java b/appointment-import/src/main/java/smash/appointment/parse/AppointmentType.java index 9698bedc8845ec0b098301823280fbf7608a707c..af458ee027a7766012c662136c971f77565a7a2f 100644 --- a/appointment-import/src/main/java/smash/appointment/parse/AppointmentType.java +++ b/appointment-import/src/main/java/smash/appointment/parse/AppointmentType.java @@ -15,7 +15,8 @@ public enum AppointmentType { LEVEL_A(new String[] { "level A" }), // LEVEL_B(new String[] { "evel B" }), // LEVEL_B_M_POWER(new String[] { "mPower" }), // - OTHER(new String[] {}), // + OTHER(new String[] {}), // + LEVEL_BV_BG_SB_MPOWER(new String[] {"BV + BG + SB + mPower"}), // ; private String[] queryStrings; diff --git a/appointment-import/src/main/java/smash/appointment/parse/CellParser.java b/appointment-import/src/main/java/smash/appointment/parse/CellParser.java index efc2e38837080ba883a10342b79f2092d8bae27d..1cea58122e0c00a2f5502d6381a12682c73df461 100644 --- a/appointment-import/src/main/java/smash/appointment/parse/CellParser.java +++ b/appointment-import/src/main/java/smash/appointment/parse/CellParser.java @@ -78,11 +78,13 @@ public class CellParser { //new one is a substring of old } else { //if there is no substring then we might have a problem AppointmentType newType = result; + logger.warn(string+ " ----- "+usedString); if (usedString.length() < string.length()) { - result = type; usedString = string; + newType = type; } logger.warn("More than one type possible for query: " + query + ". Type 1: " + result + ". Type 2: " + type + ". Choosing: " + newType); + result = newType; } } diff --git a/appointment-import/src/main/java/smash/appointment/parse/Utils.java b/appointment-import/src/main/java/smash/appointment/parse/Utils.java index 0667ea3eb5cdc466b5a573e75f12ae3f546b89df..916487ba6948c86609d8a4e273f5b4bed574121b 100644 --- a/appointment-import/src/main/java/smash/appointment/parse/Utils.java +++ b/appointment-import/src/main/java/smash/appointment/parse/Utils.java @@ -2,6 +2,6 @@ package smash.appointment.parse; public class Utils { public static String simplifyString(String query) { - return query.replaceAll("[\\s\\-©]", "").toLowerCase(); + return query.replaceAll("[\\s\\-©]", "").toLowerCase().replaceAll("\\(c\\)", ""); } } diff --git a/appointment-import/src/test/java/smash/appointment/parse/CellParserTest.java b/appointment-import/src/test/java/smash/appointment/parse/CellParserTest.java index 40311eba2e5bb3b9e53956fb2903a3960908b4ce..5c96c720cf77ba5901e0c9fe555dad58a1e23ded 100644 --- a/appointment-import/src/test/java/smash/appointment/parse/CellParserTest.java +++ b/appointment-import/src/test/java/smash/appointment/parse/CellParserTest.java @@ -29,7 +29,9 @@ public class CellParserTest extends TestBase { testCases.add(new CellParseTestCase("John Doe BV + BG + SB", johnDoe, null, AppointmentType.LEVEL_BV_BG_SB)); testCases.add(new CellParseTestCase("Kowalski-Nowak m-Power", janKowalskiNowak, null, AppointmentType.LEVEL_B_M_POWER)); testCases.add(new CellParseTestCase("ND0004 Name BV ©", cateKowalsky, null, AppointmentType.LEVEL_BV)); - + testCases.add(new CellParseTestCase("ND0004 level BV (c) + SB ©", cateKowalsky, null, AppointmentType.LEVEL_BV_SB)); + testCases.add(new CellParseTestCase("Cate Kowalsky level BV + BG + SB + m-Power", cateKowalsky, null, AppointmentType.LEVEL_BV_BG_SB_MPOWER)); + testCases.add(new CellParseTestCase("sb name level A", null, null, AppointmentType.LEVEL_A)); }