From 74b9909067167bd753d52af71a66710b9db1c4a3 Mon Sep 17 00:00:00 2001 From: Sushant Date: Tue, 22 Oct 2024 16:42:49 +0530 Subject: [PATCH] Code Rabbit Fixes removed unwanted code --- .../java/org/jembi/jempi/libapi/BackEnd.java | 27 ++----------------- 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/JeMPI_Apps/JeMPI_LibAPI/src/main/java/org/jembi/jempi/libapi/BackEnd.java b/JeMPI_Apps/JeMPI_LibAPI/src/main/java/org/jembi/jempi/libapi/BackEnd.java index c540d0b57..2f3c55027 100644 --- a/JeMPI_Apps/JeMPI_LibAPI/src/main/java/org/jembi/jempi/libapi/BackEnd.java +++ b/JeMPI_Apps/JeMPI_LibAPI/src/main/java/org/jembi/jempi/libapi/BackEnd.java @@ -528,7 +528,7 @@ private Behavior getFieldCountHandler(final GetFieldCountRequest request) request.replyTo.tell(new GetFieldCountResponse(getCount)); } catch (Exception e) { LOGGER.error(e.getLocalizedMessage(), e); - LOGGER.error("libMPI.getFieldCount failed for goldenId: {} with error: {}", e.getMessage()); + LOGGER.error("libMPI.getFieldCount failed for with error: {}", e.getMessage()); } return Behaviors.same(); } @@ -543,7 +543,7 @@ private Behavior getAgeGroupCountHandler(final GetAgeGroupCountRequest re request.replyTo.tell(new GetAgeGroupCountResponse(getCount)); } catch (Exception e) { LOGGER.error(e.getLocalizedMessage(), e); - LOGGER.error("libMPI.getAgeGroupCountHandler failed for goldenId: {} with error: {}", e.getMessage()); + LOGGER.error("libMPI.getAgeGroupCountHandler failed with error: {}", e.getMessage()); } return Behaviors.same(); } @@ -553,7 +553,6 @@ private Behavior getAllListHandler(final GetAllListRequest request) { try { dobList = libMPI.getAllList(request.allListRequest); LOGGER.info("dobList size: {}", dobList.size()); - // double allList = calculateAvarageAge(dobList); request.replyTo.tell(new GetAllListResponse(dobList)); } catch (Exception e) { LOGGER.error(e.getLocalizedMessage(), e); @@ -562,28 +561,6 @@ private Behavior getAllListHandler(final GetAllListRequest request) { return Behaviors.same(); } - public static double calculateAvarageAge(final List dobList) { - LocalDate today = LocalDate.now(); // Get today's date - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd"); // DOB format in YYYYMMDD - int totalAge = 0; - int count = 0; - // Iterate through the list of DOBs and calculate the age for each - for (String dob : dobList) { - if (dob != null && !dob.isEmpty()) { - try { - LocalDate birthDate = LocalDate.parse(dob, formatter); // Try to convert DOB to LocalDate - int age = Period.between(birthDate, today).getYears(); // Calculate age in years - totalAge += age; - count++; - } catch (DateTimeParseException e) { - LOGGER.error("Invalid date format for dob: {}. Skipping this record.", dob); - } - } - } - // Calculate and return average age - return count > 0 ? (double) totalAge / count : 0; - } - private Behavior getFieldsConfigurationHandler(final GetFieldsConfigurationRequest request) { final var separator = FileSystems.getDefault().getSeparator(); final String configDir = System.getenv("SYSTEM_CONFIG_DIRS");