@@ -147,8 +147,6 @@ private void handleDndForSubscription(Subscription subscription) {
147
147
private void doReschedule (Subscription subscription , CallRetry existingCallRetry , CallSummaryRecordDto csrDto ) {
148
148
149
149
boolean invalidNr = StatusCode .fromInt (csrDto .getStatusCode ()).equals (StatusCode .OBD_FAILED_INVALIDNUMBER );
150
- LOGGER .info ("inside doreshedule method" );
151
- LOGGER .info ("this is the data inside: {},{},{]" ,subscription ,existingCallRetry , csrDto );
152
150
if (existingCallRetry == null && SubscriptionStatus .ACTIVE .equals (subscription .getStatus ())) {
153
151
LOGGER .info ("inside condition 1" );
154
152
// We've never retried this call, let's do it
@@ -171,25 +169,21 @@ private void doReschedule(Subscription subscription, CallRetry existingCallRetry
171
169
172
170
if ((subscription .getSubscriptionPack ().retryCount () == 1 ) ||
173
171
(existingCallRetry !=null && existingCallRetry .getCallStage () == CallStage .RETRY_LAST )) {
174
- LOGGER .info ("inside condition 2" );
175
172
// This call should not be retried
176
173
177
174
// Deactivate subscription for persistent invalid numbers
178
175
// See https://github.com/motech-implementations/mim/issues/169
179
176
if (existingCallRetry != null && existingCallRetry .getInvalidNumberCount () != null &&
180
177
existingCallRetry .getInvalidNumberCount () == subscription .getSubscriptionPack ().retryCount ()) {
181
- LOGGER .info ("inside condition 3" );
182
178
subscription .setStatus (SubscriptionStatus .DEACTIVATED );
183
179
subscription .setDeactivationReason (DeactivationReason .INVALID_NUMBER );
184
180
subscriptionDataService .update (subscription );
185
181
SubscriptionServiceImpl .createDeactivatedUser (deactivatedBeneficiaryDataService , subscription , DeactivationReason .INVALID_NUMBER , false );
186
182
}
187
183
if (existingCallRetry != null && existingCallRetry .isOpt_in_call_eligibility ()
188
184
&& existingCallRetry .getCallStage () == CallStage .RETRY_LAST && existingCallRetry .getWeekId ().equals ("w1_1" )) {
189
- LOGGER .info ("inside condition 4" );
190
185
boolean optInCall = existingCallRetry .getContentFileName ().equals ("opt_in.wav" );
191
186
if (!optInCall ) {
192
- LOGGER .info ("inside condition 5" );
193
187
/*callRetryDataService.delete(existingCallRetry);
194
188
callRetryDataService.create(new CallRetry(
195
189
subscription.getSubscriptionId(),
@@ -208,12 +202,8 @@ private void doReschedule(Subscription subscription, CallRetry existingCallRetry
208
202
existingCallRetry .setContentFileName ("opt_in.wav" );
209
203
callRetryDataService .update (existingCallRetry );
210
204
} else {
211
- LOGGER .info ("inside condition 6" );
212
205
completeSubscriptionIfNeeded (subscription , csrDto .getContentFileName ());
213
206
callRetryDataService .delete (existingCallRetry );
214
- LOGGER .info ("subscription is : {}" , subscription );
215
- LOGGER .info ("csrDto is : {}" , csrDto );
216
- LOGGER .info ("whatsAppOptSMSDataService is : {}" , whatsAppOptSMSDataService );
217
207
// write message table logic here
218
208
whatsAppOptSMSDataService .create (new WhatsAppOptSMS (csrDto .getCircleName (),
219
209
"SMS_CONTENT" ,
@@ -230,7 +220,6 @@ private void doReschedule(Subscription subscription, CallRetry existingCallRetry
230
220
return ;
231
221
}
232
222
if (existingCallRetry != null ) {
233
- LOGGER .info ("inside condition 7" );
234
223
callRetryDataService .delete (existingCallRetry );
235
224
}
236
225
@@ -243,7 +232,6 @@ private void doReschedule(Subscription subscription, CallRetry existingCallRetry
243
232
244
233
// This call should indeed be re-rescheduled
245
234
if (existingCallRetry != null ) {
246
- LOGGER .info ("inside condition 8" );
247
235
existingCallRetry .setCallStage (existingCallRetry .getCallStage ().nextStage ());
248
236
existingCallRetry .setInvalidNumberCount (existingCallRetry .getInvalidNumberCount () == null ? 0 :
249
237
(existingCallRetry .getInvalidNumberCount () + (invalidNr ? 1 : 0 )));
@@ -307,9 +295,7 @@ public void processCallSummaryRecord(MotechEvent event) { //NOPMD NcssMethodCoun
307
295
String subscriptionId = "###INVALID###" ;
308
296
try {
309
297
CallSummaryRecordDto csrDto = CallSummaryRecordDto .fromParams (event .getParameters ());
310
- LOGGER .info ("this is csr dto : {}" ,csrDto );
311
298
subscriptionId = csrDto .getSubscriptionId ();
312
- LOGGER .info ("this is the subscriptionId: {}" ,subscriptionId );
313
299
csrVerifierService .verify (csrDto );
314
300
315
301
Subscription subscription = subscriptionDataService .findBySubscriptionId (subscriptionId );
@@ -318,13 +304,10 @@ public void processCallSummaryRecord(MotechEvent event) { //NOPMD NcssMethodCoun
318
304
}
319
305
320
306
CallRetry callRetry = callRetryDataService .findBySubscriptionId (subscriptionId );
321
- LOGGER .info ("this is call retry: {}" ,callRetry );
322
- LOGGER .info ("this is the final status: {}" ,FinalCallStatus .fromInt (csrDto .getFinalStatus ()));
323
307
switch (FinalCallStatus .fromInt (csrDto .getFinalStatus ())) {
324
308
case SUCCESS :
325
309
completeSubscriptionIfNeeded (subscription , csrDto .getContentFileName ());
326
310
if (callRetry != null ) {
327
-
328
311
if (!callRetry .getContentFileName ().equals ("opt_in.wav" )) {
329
312
callRetryDataService .delete (callRetry );
330
313
}
@@ -341,20 +324,8 @@ public void processCallSummaryRecord(MotechEvent event) { //NOPMD NcssMethodCoun
341
324
//If there was a DOB/LMP update during RCH import, number of weeks into subscription would have changed.
342
325
//No need to reschedule this call. Exception for w1, because regardless of which week the subscription starts in, user
343
326
//always gets w1 message initially
344
- LOGGER .info ("this is the data: {},{}" ,csrDto .getWeekId (),weekId );
345
-
346
-
347
-
348
-
349
- LOGGER .info ("this is data in db for week: {}" ,subscription .getFirstMessageDayOfWeek ());
350
- LOGGER .info ("this is data in csrdto: {}" ,DayOfTheWeek .getDayOfTheWeekFromTimestamp (csrDto .getTargetFileTimeStamp ()));
351
- LOGGER .info ("this is the condition1: {}" ,!subscription .getFirstMessageDayOfWeek ().equals (DayOfTheWeek .getDayOfTheWeekFromTimestamp (csrDto .getTargetFileTimeStamp ())));
352
- LOGGER .info ("this is condition 2: {}" , "1" .equals (extractRouteNumber (csrDto .getServiceId ())));
353
- LOGGER .info ("this is condition 2 and return : {}" ,extractRouteNumber (csrDto .getServiceId ()));
354
- LOGGER .info ("this is service id: {}" ,csrDto .getServiceId ());
355
327
if (!csrDto .getWeekId ().equals ("w1_1" )&&!weekId .equals (csrDto .getWeekId ())){
356
328
if (callRetry !=null ){
357
- LOGGER .info ("inside call retry condition" );
358
329
callRetryDataService .delete (callRetry );
359
330
}
360
331
}else if (callRetry == null && !csrDto .getWeekId ().equals ("w1_1" ) && !subscription .getFirstMessageDayOfWeek ().equals (DayOfTheWeek .getDayOfTheWeekFromTimestamp (csrDto .getTargetFileTimeStamp ())) && "1" .equals (extractRouteNumber (csrDto .getServiceId ()))) {
@@ -365,7 +336,6 @@ public void processCallSummaryRecord(MotechEvent event) { //NOPMD NcssMethodCoun
365
336
LOGGER .info ("this is the data2: {}" ,csrDto .getTargetFileTimeStamp ());
366
337
if (callRetry == null ||
367
338
!csrDto .getTargetFileTimeStamp ().equals (callRetry .getTargetFiletimestamp ())){
368
- LOGGER .info ("inside fresh or retryupdate else condition" );
369
339
doReschedule (subscription , callRetry , csrDto );
370
340
}
371
341
}
@@ -410,10 +380,8 @@ public void processCallSummaryRecord(MotechEvent event) { //NOPMD NcssMethodCoun
410
380
411
381
private String extractRouteNumber (String serviceId ) {
412
382
if (serviceId != null && serviceId .contains ("Retryonroute" )) {
413
- LOGGER .info ("inside this1" );
414
383
int startIndex = serviceId .indexOf ("Retryonroute" ) + "Retryonroute" .length ();
415
384
if (startIndex < serviceId .length ()) {
416
- LOGGER .info ("inside this2" );
417
385
return String .valueOf (serviceId .charAt (startIndex ));
418
386
}
419
387
}
0 commit comments