Commit 9cbe1f84376c4585d9102aa8b537009115d3a2cc

Authored by mfcb
1 parent 44dff023

Fixed date parsing problem in scheduler.

docker/rasa_nlu/volumes/data/api/intents/Hello_usersays_de.json
1 1 [
2 2 {
3   - "id": "4d291191-d14d-4b16-bf26-761d7a529bf6",
  3 + "id": "abbd9c3e-b916-49b6-838c-287b4cadc607",
  4 + "data": [
  5 + {
  6 + "text": "Hallä",
  7 + "userDefined": false
  8 + }
  9 + ],
  10 + "isTemplate": false,
  11 + "count": 0
  12 + },
  13 + {
  14 + "id": "4deed02d-2644-4ca0-a43c-cc3b7c76efbb",
  15 + "data": [
  16 + {
  17 + "text": "Hallu",
  18 + "userDefined": false
  19 + }
  20 + ],
  21 + "isTemplate": false,
  22 + "count": 0
  23 + },
  24 + {
  25 + "id": "097e7590-67c6-4a5d-a3c1-7e6559b561e1",
  26 + "data": [
  27 + {
  28 + "text": "Gruess dich",
  29 + "userDefined": false
  30 + }
  31 + ],
  32 + "isTemplate": false,
  33 + "count": 0
  34 + },
  35 + {
  36 + "id": "e7c5c59c-3b1e-44f3-808c-89d90501d7b3",
  37 + "data": [
  38 + {
  39 + "text": "Grüss dich",
  40 + "userDefined": false
  41 + }
  42 + ],
  43 + "isTemplate": false,
  44 + "count": 0
  45 + },
  46 + {
  47 + "id": "1ff42637-6852-4117-b109-f50d7f4797b4",
  48 + "data": [
  49 + {
  50 + "text": "Sei gegrüßt",
  51 + "userDefined": false
  52 + }
  53 + ],
  54 + "isTemplate": false,
  55 + "count": 0
  56 + },
  57 + {
  58 + "id": "09b15d97-e130-4c40-86e5-bf6005898762",
  59 + "data": [
  60 + {
  61 + "text": "Grüß dich",
  62 + "userDefined": false
  63 + }
  64 + ],
  65 + "isTemplate": false,
  66 + "count": 0
  67 + },
  68 + {
  69 + "id": "d2cd7cff-81e8-497e-875f-4bf9bbd12b3e",
  70 + "data": [
  71 + {
  72 + "text": "Hallö",
  73 + "userDefined": false
  74 + }
  75 + ],
  76 + "isTemplate": false,
  77 + "count": 0
  78 + },
  79 + {
  80 + "id": "de7f297d-1f55-44d4-954f-1e6eafe80d01",
4 81 "data": [
5 82 {
6 83 "text": "Mahlzeit!",
... ... @@ -12,7 +89,7 @@
12 89 "updated": 0
13 90 },
14 91 {
15   - "id": "552254c8-f88a-49b2-83b3-4e197b61ef07",
  92 + "id": "36269653-b1af-4b8b-8042-9b9ea1849d4b",
16 93 "data": [
17 94 {
18 95 "text": "Hallo",
... ... @@ -24,7 +101,7 @@
24 101 "updated": 0
25 102 },
26 103 {
27   - "id": "6aaf0334-05fe-4d7e-926d-2221d0d0962b",
  104 + "id": "894aa736-f662-4b3b-98f7-7ecf721f8c6c",
28 105 "data": [
29 106 {
30 107 "text": "Hallo bot.",
... ... @@ -36,7 +113,7 @@
36 113 "updated": 0
37 114 },
38 115 {
39   - "id": "68cbc708-1a9f-4812-b7b4-593e51928c8c",
  116 + "id": "0eb0339d-0538-45af-9289-c167946e7142",
40 117 "data": [
41 118 {
42 119 "text": "hallo",
... ... @@ -48,7 +125,7 @@
48 125 "updated": 0
49 126 },
50 127 {
51   - "id": "0d7b5f27-28f5-4736-823c-6b28478a567b",
  128 + "id": "f6dda0d5-8240-48b8-b1a4-3c5f909e75a2",
52 129 "data": [
53 130 {
54 131 "text": "Hallo Bot",
... ... @@ -60,7 +137,7 @@
60 137 "updated": 0
61 138 },
62 139 {
63   - "id": "d441d23a-f6a7-44cf-b97a-997f033a27d1",
  140 + "id": "a87d377b-5f67-4db7-807b-089f5801c5e7",
64 141 "data": [
65 142 {
66 143 "text": "Hallo du",
... ... @@ -72,7 +149,7 @@
72 149 "updated": 0
73 150 },
74 151 {
75   - "id": "b35c1233-b406-4248-8071-b59608efca0c",
  152 + "id": "10a084b8-7c23-43d6-b1e9-50b9c5c76fa2",
76 153 "data": [
77 154 {
78 155 "text": "Heyho",
... ... @@ -84,7 +161,7 @@
84 161 "updated": 0
85 162 },
86 163 {
87   - "id": "3c6cb884-170a-4e58-a1da-8bc7448f9604",
  164 + "id": "c0339b8d-e042-4c14-93c2-9f26c3e4e09a",
88 165 "data": [
89 166 {
90 167 "text": "Hallo Welt",
... ... @@ -96,7 +173,7 @@
96 173 "updated": 0
97 174 },
98 175 {
99   - "id": "f607efe4-3607-405a-b6db-42ba4aaa8fb9",
  176 + "id": "0fe73792-2840-4950-b650-60c0a13f90e0",
100 177 "data": [
101 178 {
102 179 "text": "Guten Tag",
... ... @@ -108,7 +185,7 @@
108 185 "updated": 0
109 186 },
110 187 {
111   - "id": "e7fd1137-4f83-4144-9806-86e56e70699a",
  188 + "id": "a8d916c7-3292-49e6-ade5-2a2850a429d2",
112 189 "data": [
113 190 {
114 191 "text": "Hello",
... ... @@ -120,7 +197,7 @@
120 197 "updated": 0
121 198 },
122 199 {
123   - "id": "df2781ee-df62-4e99-919e-d1f565a2d36c",
  200 + "id": "3e0e1510-f732-46cc-9859-69c320e2156e",
124 201 "data": [
125 202 {
126 203 "text": "Hello Bot",
... ... @@ -132,7 +209,7 @@
132 209 "updated": 0
133 210 },
134 211 {
135   - "id": "e2c249d5-b450-4fd1-90b9-06c0f53a41b5",
  212 + "id": "788cd0b0-4d3e-49d3-a8ae-7dca79eac3c2",
136 213 "data": [
137 214 {
138 215 "text": "Tag",
... ... @@ -144,7 +221,7 @@
144 221 "updated": 0
145 222 },
146 223 {
147   - "id": "ff678556-a2c5-4048-8951-56e04f990fb3",
  224 + "id": "60519a01-abd8-44ac-86ed-fae84b51ccca",
148 225 "data": [
149 226 {
150 227 "text": "Servus",
... ... @@ -156,7 +233,7 @@
156 233 "updated": 0
157 234 },
158 235 {
159   - "id": "f296c89c-c1ad-4f9d-8896-52713bc73a35",
  236 + "id": "efb01be3-e68d-493e-a425-8b7ff077d25f",
160 237 "data": [
161 238 {
162 239 "text": "Moin",
... ... @@ -168,7 +245,7 @@
168 245 "updated": 0
169 246 },
170 247 {
171   - "id": "e66d2dd6-b051-4568-bf65-a20be7ebef3e",
  248 + "id": "cdcdd7cb-e089-4c67-a3f5-ef4871d4be65",
172 249 "data": [
173 250 {
174 251 "text": "Hi",
... ...
services/MainBot/src/main/java/de/bht/beuthbot/scheduler/SchedulerBean.java
... ... @@ -164,10 +164,17 @@ public class SchedulerBean {
164 164 if (reminderTime.contains(":")) {
165 165 //split for hours and minutes
166 166 String[] splittedTime = reminderTime.split(":");
  167 +
  168 + if(splittedTime[0].length() == 1) {
  169 + splittedTime[0] = "0" + splittedTime;
  170 + }
167 171 //add hours and minutes to date
168 172 if (splittedTime.length > 1)
169 173 dateNow = splittedTime[0] + ":" + splittedTime[1];
170 174 } else {
  175 + if(reminderTime.length() == 1) {
  176 + reminderTime = "0" + reminderTime;
  177 + }
171 178 //add hours from time and set to "00"
172 179 dateNow = reminderTime + ":" + "00";
173 180 }
... ...
services/MainBot/src/main/resources/de/bht/beuthbot/drools/Canteen.drl
... ... @@ -142,7 +142,7 @@ rule "Create reminder"
142 142 String outputDate = DateStringExtractor.getGermanWeekDayFromLocalDate(reminder.getCycleDate().toLocalDate(), false);
143 143 switch(reminder.getReminderCycle().toString()) {
144 144 case "DAILY":
145   - outputDate = "täglich";
  145 + outputDate = "t\u00E4glich";
146 146 break;
147 147 case "WEEKLY":
148 148 outputDate += "s"; //if its weekly, just take the weekday and add an "s"
... ... @@ -157,7 +157,7 @@ rule "Create reminder"
157 157 if(reminder.getIntent().equals(Intent.SHOW_FOOD.getText())) {
158 158 messageText = "Ich werde dir " + outputDate + " um " + reminder.getCycleDate().toLocalTime().format(DateTimeFormatter.ofPattern("HH:mm")) + " Uhr den Mensaplan mitteilen!";
159 159 } else {
160   - messageText = "Es war mir leider nicht möglich eine Erinnerung für dich anzulegen. Versuche es bitte noch einmal.";
  160 + messageText = "Es war mir leider nicht m\u00F6glich eine Erinnerung f\u00FCr dich anzulegen. Versuche es bitte noch einmal.";
161 161 } //TODO: Add other intents
162 162 m.setText(messageText);
163 163  
... ...