Skip to content

preferred Language changes#65

Merged
helenKaryamsetty merged 4 commits intoPSMRI:developfrom
ravishanigarapu:develop
May 14, 2025
Merged

preferred Language changes#65
helenKaryamsetty merged 4 commits intoPSMRI:developfrom
ravishanigarapu:develop

Conversation

@ravishanigarapu
Copy link
Copy Markdown
Contributor

@ravishanigarapu ravishanigarapu commented May 9, 2025

📋 Description

JIRA ID: AMM-1295,AMM-1296,AMM-1297,AMM-1298

Please provide a summary of the change and the motivation behind it. Include relevant context and details.


✅ Type of Change

  • 🐞 Bug fix (non-breaking change which resolves an issue)
  • New feature (non-breaking change which adds functionality)
  • 🔥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 🛠 Refactor (change that is neither a fix nor a new feature)
  • ⚙️ Config change (configuration file or build script updates)
  • 📚 Documentation (updates to docs or readme)
  • 🧪 Tests (adding new or updating existing tests)
  • 🎨 UI/UX (changes that affect the user interface)
  • 🚀 Performance (improves performance)
  • 🧹 Chore (miscellaneous changes that don't modify src or test files)

ℹ️ Additional Information

Please describe how the changes were tested, and include any relevant screenshots, logs, or other information that provides additional context.

Summary by CodeRabbit

  • New Features

    • Added support for filtering and allocating mother and child call records by preferred language and user role, especially for associates.
    • Enabled dynamic control of API documentation and Swagger UI through environment configuration.
    • Expanded call allocation and closure logic to handle new scenarios based on call type, disconnection status, language, and user role.
  • Bug Fixes

    • Improved JWT validation filter to correctly exclude Swagger UI, API docs, and token refresh endpoints.
  • Chores

    • Updated example and environment configuration files for API documentation settings.
    • Minor formatting update in environment properties.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 9, 2025

Walkthrough

This update introduces preferred language filtering to record allocation and outbound call repository methods, especially for associate users. It also enhances call closure logic for nuanced status handling, updates JWT validation exclusions to cover API documentation endpoints, and modifies configuration files to enable dynamic control of Swagger and Springdoc features via environment variables.

Changes

File(s) Change Summary
src/main/environment/ecd_ci.properties, ecd_example.properties, ecd_uat.properties Configuration files updated: ecd_ci.properties now uses environment variable placeholders for enabling Swagger/Springdoc; ecd_example.properties explicitly enables these features; ecd_uat.properties has a formatting change (added blank line).
src/main/java/com/iemr/ecd/repo/call_conf_allocation/ChildRecordRepo.java Added a new method to fetch child records for allocation filtered by preferred language alongside existing filters.
src/main/java/com/iemr/ecd/repo/call_conf_allocation/MotherRecordRepo.java Added an overloaded method to fetch mother records for allocation, now supporting filtering by preferred language in addition to existing criteria.
src/main/java/com/iemr/ecd/repo/call_conf_allocation/OutboundCallsRepo.java Added multiple new query methods for associate users, supporting filtering by preferred language and joining with mother/child records. Includes paginated retrieval and count queries for allocated records with and without language filtering.
src/main/java/com/iemr/ecd/service/associate/CallClosureImpl.java Enhanced call closure logic: call status and allocation status are set differently based on call type, disconnection, preferred language presence, and user role. Allocated user ID is cleared for certain high-risk or introductory call conditions.
src/main/java/com/iemr/ecd/service/call_conf_allocation/CallAllocationImpl.java Refactored allocation methods for associates to conditionally fetch and allocate records based on preferred language presence, using different repository sources and updating allocation status accordingly. Added helper methods for fetching allocated calls for associates. Extended allocated call count retrieval to include associate role with language filtering.
src/main/java/com/iemr/ecd/utils/mapper/JwtUserIdValidationFilter.java Extended JWT validation exclusion logic to bypass validation for Swagger UI, API docs, and token refresh endpoints, in addition to existing exclusions.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Service
    participant MotherRepo
    participant ChildRepo
    participant OutboundCallsRepo

    User->>Service: Request allocation (with/without preferredLanguage)
    alt preferredLanguage provided
        Service->>OutboundCallsRepo: Fetch unallocated records filtered by language
        OutboundCallsRepo-->>Service: Return paged OutboundCalls
        Service->>OutboundCallsRepo: Update allocation status and user assignment
    else
        Service->>MotherRepo/ChildRepo: Fetch unallocated records
        MotherRepo/ChildRepo-->>Service: Return records
        Service->>OutboundCallsRepo: Create new OutboundCalls entities
        Service->>MotherRepo/ChildRepo: Mark records as allocated
    end
    Service-->>User: Return allocation result
Loading
sequenceDiagram
    participant Client
    participant JwtFilter

    Client->>JwtFilter: Request to /swagger-ui or /v3/api-docs
    JwtFilter-->>Client: Bypass JWT validation

    Client->>JwtFilter: Request to protected endpoint
    JwtFilter->>JwtFilter: Validate JWT
    JwtFilter-->>Client: Allow or deny access
Loading

Possibly related PRs

  • AMM-919 : Preferred Language Changes #44: Introduced preferred language fields and repository updates for language-based filtering and allocation, directly related to the new filtering logic in this PR.
  • Swagger enable or dissable changes #62: Modified the same configuration files and JWT filter to support dynamic Swagger/Springdoc toggling and exclude API docs from JWT validation, directly overlapping with this PR.

Suggested reviewers

  • devikasuresh20
  • helenKaryamsetty

Poem

In the warren of code, a new path’s unfurled,
With language and logic, new queries are twirled.
Swagger now dances at config’s command,
JWT skips where the docs proudly stand.
Associates find records in their chosen tongue—
Hopping forward, our journey’s begun!
🐇✨

Tip

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🔭 Outside diff range comments (1)
src/main/java/com/iemr/ecd/service/associate/CallClosureImpl.java (1)

195-198: ⚠️ Potential issue

Allocation status set to OPEN instead of UNALLOCATED

allocationStatus is expected to hold either allocated or unallocated (see Constants). Setting it to OPEN here mixes the call-status vocabulary with the allocation vocabulary and breaks downstream filters.

- callObj.setAllocationStatus(Constants.OPEN);
+ callObj.setAllocationStatus(Constants.UNALLOCATED);

Without this fix, UI/cron jobs that look for UNALLOCATED records will miss these calls.

♻️ Duplicate comments (1)
src/main/java/com/iemr/ecd/repo/call_conf_allocation/OutboundCallsRepo.java (1)

274-285: Same overload duplication for child queries

Exactly the same comment applies to the Child query variants:
getAllocatedRecordsUserByRecordTypeAndPhoneTypeChildAssociate is overloaded
twice. Consider consolidating as suggested above.

🧹 Nitpick comments (9)
src/main/java/com/iemr/ecd/utils/mapper/JwtUserIdValidationFilter.java (1)

58-60: Good enhancement to JWT validation exclusions

Adding exclusions for Swagger UI, API docs endpoints, and token refresh is appropriate and consistent with the configuration changes in the properties files. This allows access to API documentation without requiring authentication.

Consider also adding brief comments above each excluded path group to explain why they're excluded, enhancing code maintainability:

 // Skip login and public endpoints
 if (path.equals(contextPath + "/user/userAuthenticate")
         || path.equalsIgnoreCase(contextPath + "/user/logOutUserFromConcurrentSession")
+        // API documentation endpoints
         || path.startsWith(contextPath + "/swagger-ui")
         || path.startsWith(contextPath + "/v3/api-docs")
+        // Token refresh endpoint
         || path.startsWith(contextPath + "/user/refreshToken")
         || path.startsWith(contextPath + "/public")) {
src/main/java/com/iemr/ecd/repo/call_conf_allocation/ChildRecordRepo.java (1)

43-47: Ensure deterministic ordering & DB-agnostic boolean comparison

  1. The native query currently returns an unspecified record order. On a busy table this will pick random rows per call, which makes troubleshooting and pagination hard.
  2. IsAllocated is false is Postgres-specific; MySQL/MariaDB expect IsAllocated = false (or = 0). If the project ever swaps DBs, this will break silently.
-SELECT * FROM t_childvaliddata WHERE IsAllocated is false AND
+SELECT * FROM t_childvaliddata WHERE IsAllocated = false AND
   CreatedDate BETWEEN :fDate AND :tDate
   AND Phone_No_of = :phoneType
   AND preferredLanguage = :preferredLanguage
+  ORDER BY CreatedDate            -- deterministic fetch order
   LIMIT :recordLimit

Adding an ORDER BY (e.g., CreatedDate or a PK) and the portable boolean comparison keeps the query predictable and future-proof.

src/main/java/com/iemr/ecd/repo/call_conf_allocation/MotherRecordRepo.java (1)

48-53: Replicate the portability & ordering fix applied to the child query

The same comments made for the child query apply here: use = false instead of is false, and introduce an ORDER BY to guarantee stable ordering.

-SELECT * FROM t_mothervalidrecord WHERE IsAllocated is false AND
+SELECT * FROM t_mothervalidrecord WHERE IsAllocated = false AND
   CreatedDate BETWEEN :fDate AND :tDate
   AND PhoneNo_Of_Whom = :phoneType
   AND preferredLanguage = :preferredLanguage
+  ORDER BY CreatedDate
   LIMIT :recordLimit
src/main/java/com/iemr/ecd/service/call_conf_allocation/CallAllocationImpl.java (4)

122-132: Prefer constants & avoid duplicate repository methods

Hard-coding "unallocated" while a constant (Constants.UNALLOCATED) already exists causes brittle code and inconsistency.
In addition, getMotherRecordsForAssociate() always expects a language filter, so you needed to introduce another repo method for the “no-language” path and ended up falling back to motherRecordRepo. Re-using the existing getMotherRecordsForANM() (or adding an overload without the language predicate) would keep the service simpler and prevent repository explosion.


624-644: Branch explosion in moveAllocatedCallsToBin

The nested if/else if tree is growing quickly (ANM vs ASSOCIATE vs default).
Consider extracting role–specific behaviour into separate strategy classes or at
least a helper that takes (role, recordType, …) and returns the page. This
keeps the method readable and makes future role additions trivial.


695-725: Overloaded helper names are confusing

getOutboundCallsForMotherAssociate & getOutboundCallsForChildAssociate wrap
two repo calls that differ only by an optional language filter. The same
pattern appears many times in the repo interface.

Overloading at the repository layer is already complicated; wrapping the same
idea again in the service adds another indirection. Either:

  1. Expose one repo method with an @Nullable String preferredLanguage
    argument and build the query dynamically (@Query@Query(nativeQuery…)
    • CASE WHEN), or
  2. Keep two clearly named repo methods (…WithLanguage, …WithoutLanguage)
    and call them directly.

Both options avoid surprise overload resolution and naming duplication.


745-772: Duplicate method names hide intent

Calling outboundCallsRepo.getAllocatedRecordsCountMotherUserAssociate(…) with
either five or six parameters relies on readers remembering which overload
includes a language filter. Give the methods semantic names, e.g.
…AssociateByLanguage to make call-sites self-documenting and reduce the risk
of accidentally skipping the filter.

src/main/java/com/iemr/ecd/repo/call_conf_allocation/OutboundCallsRepo.java (2)

65-70: getMotherRecordsForAssociate duplicates ANM query

The JPQL is byte-for-byte identical to getMotherRecordsForANM. Unless the
logic needs to diverge later, keep one method and reuse it; duplicate queries
bloat the interface and maintenance surface.


237-252: Repository interface growing uncontrollably

You now have four variants of “Mother records by phone type”:

  • default
  • ANM
  • ASSOCIATE with language
  • ASSOCIATE without language

Factor out the common part—build the predicate dynamically with @Query + SpEL
or use Querydsl/Specifications. The current approach is not scalable and
risks hitting method-name length limits.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 54922ce and 363aad7.

📒 Files selected for processing (9)
  • src/main/environment/ecd_ci.properties (1 hunks)
  • src/main/environment/ecd_example.properties (1 hunks)
  • src/main/environment/ecd_uat.properties (1 hunks)
  • src/main/java/com/iemr/ecd/repo/call_conf_allocation/ChildRecordRepo.java (1 hunks)
  • src/main/java/com/iemr/ecd/repo/call_conf_allocation/MotherRecordRepo.java (1 hunks)
  • src/main/java/com/iemr/ecd/repo/call_conf_allocation/OutboundCallsRepo.java (5 hunks)
  • src/main/java/com/iemr/ecd/service/associate/CallClosureImpl.java (2 hunks)
  • src/main/java/com/iemr/ecd/service/call_conf_allocation/CallAllocationImpl.java (9 hunks)
  • src/main/java/com/iemr/ecd/utils/mapper/JwtUserIdValidationFilter.java (1 hunks)
🧰 Additional context used
🧠 Learnings (1)
src/main/environment/ecd_ci.properties (1)
Learnt from: ravishanigarapu
PR: PSMRI/ECD-API#55
File: src/main/environment/ecd_uat.properties:19-20
Timestamp: 2025-01-22T12:20:25.782Z
Learning: In the ECD-API project, Swagger UI and API docs should be enabled (set to true) in all lower environments (DEV, TEST, UAT) to facilitate API testing and documentation. Only the production environment should have these disabled.
🧬 Code Graph Analysis (2)
src/main/java/com/iemr/ecd/service/call_conf_allocation/CallAllocationImpl.java (1)
src/main/java/com/iemr/ecd/utils/constants/Constants.java (1)
  • Constants (5-21)
src/main/java/com/iemr/ecd/service/associate/CallClosureImpl.java (1)
src/main/java/com/iemr/ecd/utils/constants/Constants.java (1)
  • Constants (5-21)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (java)
🔇 Additional comments (3)
src/main/environment/ecd_uat.properties (1)

25-25: LGTM - Minor whitespace addition is acceptable

This change only adds a blank line at the end of the file, which is a common convention for ensuring files end with a newline.

src/main/environment/ecd_ci.properties (1)

28-29: Parameterizing Swagger configuration is a good approach

The change allows dynamic control of Swagger and Springdoc API features via environment variables, which is more flexible than hardcoded values. This aligns with the PR's focus on preferred language changes and enhances configurability for different environments.

src/main/environment/ecd_example.properties (1)

19-22: Enabling Swagger documentation for development environment

Enabling Swagger UI and API docs in the example properties file is appropriate and aligns with the retrieved learning that API documentation should be enabled in non-production environments to facilitate testing and development.

Comment thread src/main/java/com/iemr/ecd/service/associate/CallClosureImpl.java Outdated
Comment on lines +297 to 318
} else if (null != childRecordsForAssociate && !childRecordsForAssociate.isEmpty()) {
outBoundCallList = childRecordsForAssociate.getContent();

if (!outBoundCallList.isEmpty()) {
for (OutboundCalls outboundCall : outBoundCallList) {
try {
outboundCall.setAllocationStatus(Constants.ALLOCATED);
outboundCall.setAllocatedUserId(callAllocationDto.getToUserIds()[callCountPointer
/ callAllocationDto.getNoOfCalls()]);

outboundCall.setCallAttemptNo(0);

callCountPointer++;
} catch (Exception e) {
callCountPointer++;
}
}
outboundCallsRepo.saveAll(outBoundCallList);
}
} else {
throw new ECDException("no eligible record available to allocate, please contact administrator");
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Same “zero records” edge-case applies to child allocation

The branch that handles childRecordsForAssociate can also end up returning a
success message with an empty list. Mirror the guard added for the mother
path.

Comment thread src/main/java/com/iemr/ecd/service/call_conf_allocation/CallAllocationImpl.java Outdated
Comment on lines +166 to +178
@Query(value = " SELECT COUNT(1) FROM OutboundCalls AS t INNER JOIN MotherRecord AS mv ON t.motherId = mv.ecdIdNo WHERE t.allocatedUserId=:allocatedUserId AND "
+ " ((:fDate between t.callDateFrom AND t.callDateTo) OR (:tDate between t.callDateFrom AND t.callDateTo)) AND t.callStatus=:callStatus "
+ " AND t.phoneNumberType=:phoneNoType AND t.childId IS NULL AND t.motherId IS NOT NULL AND mv.preferredLanguage = :preferredLanguage")
int getAllocatedRecordsCountMotherUserAssociate(@Param("allocatedUserId") Integer allocatedUserId,
@Param("fDate") Timestamp fDate, @Param("tDate") Timestamp tDate, @Param("callStatus") String callStatus,
@Param("phoneNoType") String phoneNoType,@Param("preferredLanguage") String preferredLanguage);

@Query(value = " SELECT COUNT(1) FROM OutboundCalls AS t INNER JOIN MotherRecord AS mv ON t.motherId = mv.ecdIdNo WHERE t.allocatedUserId=:allocatedUserId AND "
+ " ((:fDate between t.callDateFrom AND t.callDateTo) OR (:tDate between t.callDateFrom AND t.callDateTo)) AND t.callStatus=:callStatus "
+ " AND t.phoneNumberType=:phoneNoType AND t.childId IS NULL AND t.motherId IS NOT NULL")
int getAllocatedRecordsCountMotherUserAssociate(@Param("allocatedUserId") Integer allocatedUserId,
@Param("fDate") Timestamp fDate, @Param("tDate") Timestamp tDate, @Param("callStatus") String callStatus,
@Param("phoneNoType") String phoneNoType);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Ambiguous overloads may trip developers

Two methods named getAllocatedRecordsCountMotherUserAssociate differ only by
the presence of preferredLanguage. Spring Data JPA supports overloading, but
the names give no clue which version is in use, and IDE autocomplete often
lists them consecutively without distinction.

Rename to something expressive, e.g.
getAllocatedRecordsCountMotherUserAssociateByLanguage and
getAllocatedRecordsCountMotherUserAssociateAllLang.

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 9, 2025

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
src/main/java/com/iemr/ecd/service/call_conf_allocation/CallAllocationImpl.java (1)

285-306: Same "zero records" edge-case applies to child allocation

The branch that handles childRecordsForAssociate can also end up returning a success message with an empty list. Mirror the guard added for the mother path.

🧹 Nitpick comments (1)
src/main/java/com/iemr/ecd/service/call_conf_allocation/CallAllocationImpl.java (1)

683-696: Method naming inconsistency

There's an inconsistency in the method naming convention between this method and the one at line 698.

- private Page<OutboundCalls> getOutboundCallsForMotherAssociate(Pageable pageable,
+ private Page<OutboundCalls> getOutboundCallsForMotherAssociate(Pageable pageable,
- private Page<OutboundCalls> getOutboundcallsForChildAssociate(Pageable pageable,
+ private Page<OutboundCalls> getOutboundCallsForChildAssociate(Pageable pageable,
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 363aad7 and e7e110b.

📒 Files selected for processing (3)
  • src/main/java/com/iemr/ecd/repo/call_conf_allocation/OutboundCallsRepo.java (5 hunks)
  • src/main/java/com/iemr/ecd/service/associate/CallClosureImpl.java (3 hunks)
  • src/main/java/com/iemr/ecd/service/call_conf_allocation/CallAllocationImpl.java (8 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/main/java/com/iemr/ecd/service/associate/CallClosureImpl.java
  • src/main/java/com/iemr/ecd/repo/call_conf_allocation/OutboundCallsRepo.java
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/main/java/com/iemr/ecd/service/call_conf_allocation/CallAllocationImpl.java (1)
src/main/java/com/iemr/ecd/utils/constants/Constants.java (1)
  • Constants (5-21)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (java)
🔇 Additional comments (6)
src/main/java/com/iemr/ecd/service/call_conf_allocation/CallAllocationImpl.java (6)

125-191: Good implementation of preferred language filtering logic

The implementation correctly branches based on whether a preferred language is specified, using the appropriate repository methods. The code also properly throws exceptions when no eligible records are found.


228-235: Good implementation of child record language filtering

The conditional logic for fetching either language-filtered or regular child records is implemented correctly.


683-713: Good extraction of common repository query logic

These helper methods effectively encapsulate the repository calls for fetching records, making the code more modular and maintainable.


736-747: Good implementation of associate role handling

The code correctly handles the associate role by implementing separate logic branches with appropriate repository calls based on preferred language presence.


752-760: Good implementation of child record counts for associates

The logic correctly branches based on preferred language presence and uses the appropriate repository methods.


612-631: Good integration of associate role in bin operation

The implementation correctly integrates the associate role with proper repository call delegation to helper methods.

// Assuming updateIsAllocatedStatus updates all in one batch
}

outboundCallsRepo.saveAll(outBoundCallList);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Redundant database call

This saveAll operation is redundant as it's already handled in both conditional branches (lines 188 and 151). This could lead to unnecessary database operations and potential performance issues.

- outboundCallsRepo.saveAll(outBoundCallList);
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
outboundCallsRepo.saveAll(outBoundCallList);

@helenKaryamsetty helenKaryamsetty merged commit 66e2a8b into PSMRI:develop May 14, 2025
7 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request May 26, 2025
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants