Skip to content
Snippets Groups Projects
Commit 43f1207e authored by Piotr Gawron's avatar Piotr Gawron
Browse files

appointment type resolving conflicts improved

parent 7feddecc
No related branches found
No related tags found
1 merge request!1Appointments dev
...@@ -15,7 +15,8 @@ public enum AppointmentType { ...@@ -15,7 +15,8 @@ public enum AppointmentType {
LEVEL_A(new String[] { "level A" }), // LEVEL_A(new String[] { "level A" }), //
LEVEL_B(new String[] { "evel B" }), // LEVEL_B(new String[] { "evel B" }), //
LEVEL_B_M_POWER(new String[] { "mPower" }), // 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; private String[] queryStrings;
......
...@@ -78,11 +78,13 @@ public class CellParser { ...@@ -78,11 +78,13 @@ public class CellParser {
//new one is a substring of old //new one is a substring of old
} else { //if there is no substring then we might have a problem } else { //if there is no substring then we might have a problem
AppointmentType newType = result; AppointmentType newType = result;
logger.warn(string+ " ----- "+usedString);
if (usedString.length() < string.length()) { if (usedString.length() < string.length()) {
result = type;
usedString = string; usedString = string;
newType = type;
} }
logger.warn("More than one type possible for query: " + query + ". Type 1: " + result + ". Type 2: " + type + ". Choosing: " + newType); logger.warn("More than one type possible for query: " + query + ". Type 1: " + result + ". Type 2: " + type + ". Choosing: " + newType);
result = newType;
} }
} }
......
...@@ -2,6 +2,6 @@ package smash.appointment.parse; ...@@ -2,6 +2,6 @@ package smash.appointment.parse;
public class Utils { public class Utils {
public static String simplifyString(String query) { public static String simplifyString(String query) {
return query.replaceAll("[\\s\\-©]", "").toLowerCase(); return query.replaceAll("[\\s\\-©]", "").toLowerCase().replaceAll("\\(c\\)", "");
} }
} }
...@@ -29,7 +29,9 @@ public class CellParserTest extends TestBase { ...@@ -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("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("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 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));
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment