Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Gerelsukh
Copy link
Collaborator

@Gerelsukh Gerelsukh commented May 22, 2025

Screenshot 2025-05-28 at 09 41 25 Screenshot 2025-05-28 at 09 42 30

Important

Improves loan and savings contract synchronization with Polaris by adding new GraphQL mutations, enhancing error handling, and updating UI components.

  • Backend Changes:
    • Added new GraphQL mutations for sending and activating loan and savings contracts in mutations.ts.
    • Implemented createLoanMessage, createSavingMessage, activeLoan, and activeSaving functions for handling contract synchronization and activation.
    • Enhanced error handling and logging in fetchPolaris and related utility functions.
  • Frontend Changes:
    • Updated UI components in loanPolaris and savingPolaris directories to display synchronization status and allow re-sending of contracts.
    • Added PolarisSection, LoanActive, and SavingActive components for better user interaction.
    • Integrated new GraphQL queries and mutations in Polaris.tsx containers for handling contract data.

This description was created by Ellipsis for 5088f13. You can customize this summary. It will automatically update as commits are pushed.

@sourcery-ai
Copy link

sourcery-ai bot commented May 22, 2025

Reviewer's Guide

This PR refactors and standardizes the Polaris loan sync scripts—normalizing quotes and formatting—while extending transaction grouping to detect disbursements, separating “give” vs repayment flows, and introducing a full suite of scheduling utilities to generate and adjust loan repayment schedules based on varying rules.

Sequence Diagram for New "Give" Transaction Handling

sequenceDiagram
    participant S as syncTransactions
    participant LT_DB as LoanTransaction_DB
    participant ASG as afterGiveTrInSchedule
    participant LS_DB as LoanSchedules_DB
    participant FG as firstGiveTr
    participant GS as generateSchedules
    participant FSG as fixFutureSchedulesGive

    S->>+LT_DB: insertOne({transactionType: "give", ...})
    LT_DB-->>S: new_transaction (tr)
    S->>ASG: afterGiveTrInSchedule(LS_DB, foundCT, tr)
    activate ASG
    ASG->>LS_DB: findOne(contractId) (check existing schedules)
    alt No existing schedules
        LS_DB-->>ASG: null
        ASG->>FG: firstGiveTr(LS_DB, foundCT, tr)
        activate FG
        FG->>LS_DB: insertOne(initial "give" schedule)
        FG->>GS: generateSchedules(LS_DB, foundCT, unUsedBalance)
        activate GS
        GS-->>FG: bulkEntries
        deactivate GS
        FG->>LS_DB: insertMany(bulkEntries)
        deactivate FG
    else Existing schedules
        LS_DB-->>ASG: existing_schedules
        ASG->>LS_DB: getCalcedAmountsOnDate(...)
        ASG->>LS_DB: insertOne(new "give" schedule for transaction)
        LS_DB-->>ASG: currentSchedule
        ASG->>LS_DB: find(futureSchedules)
        LS_DB-->>ASG: futureSchedules
        ASG->>FSG: fixFutureSchedulesGive(LS_DB, foundCT, currentSchedule, futureSchedules)
        activate FSG
        FSG-->>ASG: updateBulkOps (representing new schedule data)
        deactivate FSG
        ASG->>LS_DB: bulkWrite(updateBulkOps)
    end
    ASG-->>S: result
    deactivate ASG
Loading

Class Diagram for Loan Synchronization and Scheduling Modules

classDiagram
    class ScheduleGenerationModule {
        +generateSchedules(contract, unUsedBalance)
        +scheduleHelper(bulkEntries, params, dateRanges)
        +calcPerMonthEqual(params)
        +calcPerMonthFixed(params)
        +calcAllMonthLast(params)
        +getEqualPay(params)
        +generateDates(startDate, scheduleDays, tenor, holidayType, weekends, perHolidays, firstPayDate)
        +getCorrectDate(genDate, holidayType, weekends, perHolidays)
        +addMonths(date, months)
        +getSkipDate(currentDate, skipMonth, skipDay)
    }

    class TransactionProcessingModule {
        +syncTransactions(huulga, aprvAmnt, LoanTransaction, LoanSchedules, LoanContracts, loanContract)
        +afterPayTrInSchedule(LoanSchedules, foundCT, tr)
        +afterGiveTrInSchedule(LoanSchedules, foundCT, tr)
        +firstGiveTr(LoanSchedules, foundCT, tr)
        +dateGroup(data, aprvAmnt)
    }

    class ScheduleAdjustmentModule {
      +fixFutureSchedulesGive(LoanSchedules, contract, currentSchedule, futureSchedules)
      +getCalcedAmountsOnDate(LoanSchedules, contract, date, calculationFixed)
      +overPaymentFutureImpact(...)
      +fixFutureSchedulesNext(...)
      +fixFutureSchedulesLast(...)
    }

    TransactionProcessingModule --|> ScheduleGenerationModule : Uses
    TransactionProcessingModule --|> ScheduleAdjustmentModule : Uses
    ScheduleAdjustmentModule --|> ScheduleGenerationModule : Uses
Loading

File-Level Changes

Change Details Files
Code style and formatting normalization
  • Converted single quotes to double quotes
  • Added trailing commas on object literals
  • Standardized console.log messages and string concatenations
packages/plugin-loans-api/src/commands/syncCollateralPolaris.ts
packages/plugin-loans-api/src/commands/syncPolaris.ts
Enhanced dateGroup signature and filtering
  • Added aprvAmnt parameter to dateGroup
  • Expanded transaction filter to include outcome or balance matching approved amount
  • Updated error messages to use consistent quote style
packages/plugin-loans-api/src/commands/syncCollateralPolaris.ts
Separated handling of disbursement (“give”) vs repayment in syncTransactions
  • Introduced branch detecting outcome or balance == aprvAmnt as a “give” transaction
  • Built distinct document schema for give transactions and invoked afterGiveTrInSchedule
  • Retained original repayment path for income transactions
packages/plugin-loans-api/src/commands/syncCollateralPolaris.ts
Added comprehensive loan scheduling utilities
  • Created date calculation helpers (getCorrectDate, generateDates, addMonths, getSkipDate)
  • Implemented interest and payment calculators (calcPerMonthEqual, calcPerMonthFixed, calcAllMonthLast)
  • Built scheduleHelper, generateSchedules, fixFutureSchedulesGive to assemble and update schedules
packages/plugin-loans-api/src/commands/syncCollateralPolaris.ts
Refined MongoDB operations and upsert logic
  • Replaced create with insertOne/insertMany for consistency
  • Updated bulkWrite/updateOne calls to use upsert:true
  • Standardized collection initializations with uniform quotes
packages/plugin-loans-api/src/commands/syncCollateralPolaris.ts
packages/plugin-loans-api/src/commands/syncPolaris.ts

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai
Copy link

coderabbitai bot commented May 22, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Caution

Changes requested ❌

Reviewed everything up to e412585 in 2 minutes and 44 seconds. Click for details.
  • Reviewed 2034 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 9 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. packages/plugin-loans-api/src/commands/syncCollateralPolaris.ts:1
  • Draft comment:
    The 'nanoid' function is defined here and elsewhere; consider extracting it to a shared utility module.
  • Reason this comment was not posted:
    Comment was on unchanged code.
2. packages/plugin-loans-api/src/commands/syncCollateralPolaris.ts:1887
  • Draft comment:
    Avoid hardcoding sensitive credentials (e.g., NESSESSION, Company, Role) in fetchPolaris; use environment variables or config files instead.
  • Reason this comment was not posted:
    Comment was on unchanged code.
3. packages/plugin-loans-api/src/commands/syncPolaris.ts:33
  • Draft comment:
    Duplicate 'nanoid' function detected; consider reusing a common utility instead.
  • Reason this comment was not posted:
    Comment was on unchanged code.
4. packages/plugin-loans-api/src/commands/syncPolaris.ts:46
  • Draft comment:
    Duplicate 'fetchPolaris' function; combine shared network logic into a single module to DRY up the code.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
5. packages/plugin-loans-api/src/commands/syncPolaris.ts:16
  • Draft comment:
    Hardcoded MONGO_URL should be externalized via environment variables or configuration rather than being fixed in code.
  • Reason this comment was not posted:
    Comment was on unchanged code.
6. packages/plugin-loans-api/src/commands/syncPolaris.ts:259
  • Draft comment:
    Using process.exit() can terminate the process abruptly; consider handling errors and allowing a graceful shutdown.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
7. packages/plugin-loans-api/src/commands/syncPolaris.ts:152
  • Draft comment:
    The filter condition 'contract.statusName !== "Хаасан"' uses a non-English literal; ensure this is intentional and documented.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 0% vs. threshold = 50% This appears to be intentional use of Mongolian text since it's filtering based on status names from what seems to be a Mongolian financial system. The code needs to match the exact status name from the external system. Translating it to English could actually cause bugs. Documentation could be helpful but isn't strictly necessary since the code's purpose is clear from context. The reviewer has a point that non-English text can make code harder to maintain for international teams. A comment explaining the status meaning could be helpful. However, this is clearly intentional as it needs to match external system values, and the meaning is clear enough from context. Adding documentation is optional enhancement rather than a required fix. The comment should be deleted as it's not pointing out a real issue - using the Mongolian text is correct and necessary here.
8. packages/plugin-loans-api/src/commands/syncCollateralPolaris.ts:2052
  • Draft comment:
    Typo detected in console.log message: "1111111bnubnubnu". Consider revising if this is unintended.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% The rules state to not make purely informative comments and to only comment if there is clearly a code change required. While improving debug logs is good practice, this is not a critical issue that requires a code change. Debug logs are typically temporary and not part of the core functionality. The comment is more of a suggestion than a required fix. The log message could be confusing for debugging, and improving it would help code maintainability. There's an argument that unclear debug messages make troubleshooting harder. However, debug logs are not part of the core functionality and are often temporary. The rules specifically say not to make purely informative comments. This falls into that category since it's just suggesting a clearer message for debugging. The comment should be removed as it is a purely informative suggestion about debug logging that doesn't impact functionality.
9. packages/plugin-loans-api/src/commands/syncCollateralPolaris.ts:2074
  • Draft comment:
    Typo detected in console.log message: "2222zayaj bn ". The trailing space may be unintended. Please verify if this output is as expected.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 0% vs. threshold = 50% Console.log messages are for debugging purposes and their exact formatting is not critical to the functionality. The trailing space has no impact on the code's behavior. Additionally, console.log statements are often temporary and may be removed later. Could the trailing space cause any issues with log parsing or monitoring tools? Could this be part of a broader effort to maintain consistent logging format? Even if log parsing is a concern, this is a debug log that likely won't be used in production. The benefit of fixing this is minimal compared to the overhead of making the change. This comment should be removed as it addresses a trivial formatting issue in a debug console.log statement that has no functional impact.

Workflow ID: wflow_xpxVqlKIpA5GkGJt

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

for (const subDay of dateRange) {
const genDate = getFullDate(new Date(year, month, subDay));

if (dateRanges.includes(genDate) || mainDate > genDate) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid using array.includes() to compare Date objects; use getTime() for equality instead.

Suggested change
if (dateRanges.includes(genDate) || mainDate > genDate) {
if (dateRanges.some(d => d.getTime() === genDate.getTime()) || mainDate > genDate) {


// const pLoanContracts = await fetchPolaris('13610210', [
// 'CIF-13000112',
// const huulga = await fetchPolaris("13610201", [
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove commented-out code to improve readability and maintainability.

Suggested change
// const huulga = await fetchPolaris("13610201", [

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Caution

Changes requested ❌

Reviewed 7c51420 in 2 minutes and 37 seconds. Click for details.
  • Reviewed 1017 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 6 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. packages/plugin-loans-api/src/commands/syncLoansPolaris.js:520
  • Draft comment:
    Remove debug console.log statements (e.g. '1111111111', '2222222222', etc.) in getCalcedAmountsOnDate before production.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
2. packages/plugin-loans-api/src/commands/syncLoansPolaris.js:591
  • Draft comment:
    BUG: The 'total' field in the returned object of getCalcedAmountsOnDate subtracts the same value, always resulting in 0. Likely intended to subtract didTotal.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
3. packages/plugin-loans-api/src/commands/syncLoansPolaris.js:1240
  • Draft comment:
    When using Array.includes to check if a Date object is already in dateRanges, the comparison may fail due to reference equality. Compare date values (e.g. using getTime()) instead.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
4. packages/plugin-loans-api/src/commands/syncLoansPolaris.js:535
  • Draft comment:
    Typo detected: The property name 'unUsedBalance' appears to have an inconsistent casing. Consider renaming it to 'unusedBalance' for more consistent and standard camelCase.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
5. packages/plugin-loans-api/src/commands/syncLoansPolaris.js:1808
  • Draft comment:
    Typo alert: The property name unUsedBalance seems to contain inconsistent capitalization. Consider renaming it to unusedBalance to follow typical naming conventions.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% While camelCase typically uses lowercase for internal words, this appears to be a deliberate stylistic choice used consistently throughout the codebase. Changing it would require changes in many places and could introduce inconsistency with other related variables. The current name is clear and readable, even if it doesn't follow typical conventions. The comment correctly identifies a deviation from typical camelCase conventions. However, it fails to consider the existing codebase conventions and the cost/benefit of making such a change. While the suggestion aligns with typical conventions, maintaining internal consistency within a codebase is often more important than following external conventions. The current naming is clear and consistently used. The comment should be deleted. The variable name is used consistently throughout the codebase and changing it would create more problems than it solves.
6. packages/plugin-loans-api/src/commands/syncLoansPolaris.js:1901
  • Draft comment:
    Typographical note: The property name 'unUsedBalance' uses an unusual camelCase pattern. It may be intended to be 'unusedBalance' to match common naming conventions. Please double-check if this was intentional.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% While the comment is technically correct about camelCase conventions, this seems like a minor stylistic issue. The code is being renamed from .ts to .js, suggesting it's a migration/conversion. The variable name is used consistently throughout the codebase. Changing it would require many changes and could introduce bugs. The current name, while not perfect, is clear and functional. The comment does identify a real style issue. Consistent naming conventions are important for code maintainability. Maybe this is a good time to fix it during the TypeScript to JavaScript conversion? While style consistency is important, this change would be risky - it would require changing the name in many places in complex financial calculation code. The benefit doesn't justify the risk. The current name is clear enough. Delete the comment. While technically correct, suggesting a variable rename in complex financial calculation code is too risky for too little benefit. The current name is clear and functional.

Workflow ID: wflow_OgGYXbiF6jrKQ6hB

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

dotenv.config();

// const { MONGO_URL } = process.env;
const MONGO_URL = "mongodb://127.0.0.1:27017/erxes?directConnection=true";
Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid hardcoding the MONGO_URL (lines 10-11). Use an environment variable instead to prevent exposing sensitive details.

Suggested change
const MONGO_URL = "mongodb://127.0.0.1:27017/erxes?directConnection=true";
const { MONGO_URL } = process.env;

return randomString;
};

const fetchPolaris = async (op, body) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

The fetchPolaris function mixes async/await with .then/.catch. Consider refactoring to a consistent async/await style for improved readability.

const fetchPolaris = async (op, body) => {
const headers = {
Op: op,
Cookie: `NESSESSION=03tv40BnPzFEEcGgsFxkhrAUTN7Awh`,
Copy link
Contributor

Choose a reason for hiding this comment

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

Sensitive data (session token, company, and role) are hardcoded in the request headers. These credentials should be stored securely (e.g., via environment variables).

Suggested change
Cookie: `NESSESSION=03tv40BnPzFEEcGgsFxkhrAUTN7Awh`,
Cookie: `NESSESSION=${process.env.POLARIS_SESSION_TOKEN}`,

continue;
}

const pLoanContracts = await fetchPolaris("13610210", [
Copy link
Contributor

Choose a reason for hiding this comment

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

Multiple sequential API calls within nested loops (e.g. per customer and per contract) may lead to performance issues. Consider parallelizing or batching these calls.

Users = db.collection("users");

console.log(`Process start at: ${new Date()}`);
// const customerFilter = { code: { $exists: true } };
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove commented out code segments unless they are truly needed for future reference to maintain clarity.

Suggested change
// const customerFilter = { code: { $exists: true } };

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Caution

Changes requested ❌

Reviewed 9a0affd in 1 minute and 43 seconds. Click for details.
  • Reviewed 388 lines of code in 5 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. packages/plugin-syncpolaris-ui/src/savingPolaris/containers/Polaris.tsx:29
  • Draft comment:
    Inconsistent contract identifier: this query sets contentId to contract._id, whereas elsewhere (e.g. in ActiveContainer) contract.number is used. Ensure the correct and consistent field is used.
  • Reason this comment was not posted:
    Comment was on unchanged code.
2. packages/plugin-syncpolaris-ui/src/savingPolaris/containers/Polaris.tsx:67
  • Draft comment:
    Repeated error handling logic in mutation catch blocks: the client.refetchQueries call is duplicated. Consider refactoring this repeated code to improve maintainability.
  • Reason this comment was not posted:
    Confidence changes required: 50% <= threshold 50% None

Workflow ID: wflow_gnDuMdXv1GvHJHnL

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

const result = await fetchPolaris({
op: '13610122',
data: [params.contractNumber, 'данс нээв'],
data: ['params.contractNumber', 'данс нээв'],
Copy link
Contributor

Choose a reason for hiding this comment

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

Potential bug: the data array is using a string literal 'params.contractNumber' instead of the variable params.contractNumber. This likely causes incorrect data to be sent.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed 0b3ef29 in 1 minute and 11 seconds. Click for details.
  • Reviewed 77 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 4 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. packages/plugin-syncpolaris-ui/src/savingPolaris/components/PolarisList.tsx:1
  • Draft comment:
    Imports now use single quotes per style guidelines. This cleanup improves consistency.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
2. packages/plugin-syncpolaris-ui/src/savingPolaris/components/PolarisList.tsx:40
  • Draft comment:
    Inline styles are used (width and marginTop). Consider extracting these into a styled component if they are reused for better maintainability.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
3. packages/plugin-syncpolaris-ui/src/savingPolaris/components/PolarisList.tsx:67
  • Draft comment:
    Header label changed to 'Message' (was 'Saving Amount'). Ensure this label accurately reflects the data being displayed.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None
4. packages/plugin-syncpolaris-ui/src/savingPolaris/components/SavingActive.tsx:75
  • Draft comment:
    Header label updated from 'Error' to 'Message'. Confirm that 'Message' properly conveys the content (be it error or informational response) to the user.
  • Reason this comment was not posted:
    Confidence changes required: 0% <= threshold 50% None

Workflow ID: wflow_TN6BqohtEStlIfsM

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Caution

Changes requested ❌

Reviewed 18ff588 in 3 minutes and 0 seconds. Click for details.
  • Reviewed 3319 lines of code in 34 files
  • Skipped 0 files when reviewing.
  • Skipped posting 14 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. packages/plugin-syncpolaris-ui/src/loanPolaris/components/LoanInfo.tsx:24
  • Draft comment:
    Ensure that using data?.getPolarisData?[value] aligns with the response; verify property names in the API response.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to verify property names in the API response, which is against the rules as it asks for confirmation and verification. It does not provide a specific suggestion or point out a clear issue.
2. packages/plugin-syncpolaris-ui/src/loanPolaris/components/PolarisList.tsx:43
  • Draft comment:
    Review if 'Polaris Contract Id' header is appropriately named; ensure it consistently reflects the data field.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the author to review and ensure consistency, which violates the rule against asking the author to confirm or ensure things. It doesn't provide a specific suggestion or point out a clear issue.
3. packages/plugin-syncpolaris-ui/src/loanPolaris/components/ScheduleSection.tsx:45
  • Draft comment:
    Verify that showing the schedule based on contract.isSyncedSchedules is correct and handles cases with no schedules.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to verify the correctness of a specific behavior, which violates the rule against asking for confirmation or verification of intended behavior. It does not provide a specific suggestion or point out a clear issue.
4. packages/plugin-syncpolaris-ui/src/loanPolaris/containers/Collateral.tsx:24
  • Draft comment:
    Review the fallback for contract?.collateralsData?.[0]?._id; ensure using an empty string is appropriate if no data is present.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% The comment is asking the author to "ensure" something, which violates our rules. It's speculative and asking for verification rather than pointing out a clear issue. Without seeing the GraphQL schema or knowing how the API handles empty strings, we can't be certain this is actually problematic. The code is using TypeScript and proper optional chaining, suggesting the author has considered the null case. Maybe an empty string could cause API errors if the GraphQL endpoint doesn't handle it well. The comment might be trying to prevent runtime issues. While that's possible, we don't have evidence that empty string causes issues. The comment should point out a specific problem if one exists, not ask for verification. Delete this comment as it's asking for verification without providing evidence of an actual issue, and we don't have enough context to know if empty string is problematic.
5. packages/core-ui/src/modules/layout/components/navigation/types.ts:136
  • Draft comment:
    The newly added property is named loanPolarisSection. Given the pull request title mentions "loans", you might want to double-check if this should be loansPolarisSection for consistency.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% The comment is speculative and relies on information outside the file (PR title). The file itself shows a pattern of using singular forms (savingPolarisSection). The comment is asking the author to double-check something rather than pointing out a clear issue. This violates the rule about not asking authors to verify things. Maybe there's a broader codebase convention I'm not aware of. The PR title could indicate a stronger reason for using plural form. Even if there is a broader convention, the comment is phrased as a suggestion to double-check rather than pointing out a clear violation. The local file evidence suggests singular form is acceptable. Delete the comment. It's speculative, asks for verification rather than pointing out a clear issue, and goes against the pattern shown in the immediate file context.
6. packages/plugin-loans-api/src/commands/syncLoansPolaris.js:1579
  • Draft comment:
    Typographical note: The property name 'unUsedBalance' appears inconsistent with typical camelCase conventions. If intended, consider renaming it to 'unusedBalance' to improve readability.
  • Reason this comment was not posted:
    Comment was on unchanged code.
7. packages/plugin-loans-api/src/commands/syncLoansPolaris.js:1973
  • Draft comment:
    Typo: The property name "unUsedBalance" may contain an unintended capital 'U'. If the intended variable is in camelCase, consider renaming it to "unusedBalance" for consistency.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
8. packages/plugin-loans-api/src/commands/syncLoansPolaris.js:2206
  • Draft comment:
    Typo alert: The debug log message '1111111bnubnubnu' appears to contain a typographical error. Please verify if this is the intended message.
  • Reason this comment was not posted:
    Comment was on unchanged code.
9. packages/plugin-loans-api/src/commands/syncLoansPolaris.js:2228
  • Draft comment:
    Typo alert: The debug log message '2222zayaj bn ' might contain a typographical error. Please confirm if this is correct or needs correction.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 0% vs. threshold = 50% Debug log messages are not part of the core functionality. The comment is about code style rather than logic. The message is likely intentionally written in another language for the developers' understanding. The rules state we should not make purely informative comments or comments that are not clearly requiring a code change. Could the log message actually indicate a deeper issue with error handling or logging standards? Could inconsistent language use in logs cause problems for other developers? While consistent logging standards are important, this is a debug message that doesn't affect functionality. If there were logging standards to enforce, that would be a separate architectural discussion, not a PR comment. The comment should be removed as it is purely informative and does not clearly require a code change. Debug messages are not critical to review.
10. packages/plugin-syncpolaris-ui/src/configs.js:24
  • Draft comment:
    Typo detected: The action value 'syncPolarisonfig' appears to be misspelled. It likely should be 'syncPolarisConfig'.
  • Reason this comment was not posted:
    Comment was on unchanged code.
11. packages/plugin-syncpolaris-ui/src/loanPolaris/components/CollateralSection.tsx:61
  • Draft comment:
    Typographical concern: Both table headers are labeled "Is Sync Collateral". Please verify if this duplicate header is intentional or if one of them should be updated.
  • Reason this comment was not posted:
    Marked as duplicate.
12. packages/plugin-syncpolaris-ui/src/loanPolaris/components/ScheduleSection.tsx:26
  • Draft comment:
    Minor text consistency issue: The button title is "send schedule" with a lowercase 's'. It might be more consistent and clear to use "Send Schedule".
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 0% vs. threshold = 50% The rules explicitly state "Do NOT comment on any pure frontend UI or styling changes, only logic. Assume that if the author changed the UI, they did it correctly." This is clearly a UI styling suggestion about text casing, not a logic issue. The current casing doesn't affect functionality. The inconsistent casing could potentially affect user experience and maintainability of the codebase. Other similar buttons might use title case. While consistency is good, the rules are clear that we should trust the author on UI decisions and not comment on pure UI/styling changes. This comment should be removed as it violates the rule about not commenting on UI/styling changes.
13. packages/plugin-syncpolaris-ui/src/loanPolaris/components/ScheduleSection.tsx:44
  • Draft comment:
    Typographical note: The table header text "Is Sync Schedule" seems awkward. Consider rewording it to something like "Synced Schedule" or "Is Schedule Synced?" to improve readability.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% The rules explicitly state "Do NOT comment on any pure frontend UI or styling changes, only logic." While this is a new file, the comment is purely about UI text wording and doesn't affect functionality. The author likely chose this wording deliberately, and we should trust their judgment on UI matters. The text is genuinely awkward grammatically, and fixing it could improve user experience. Maybe this goes beyond pure styling into usability? No, our rules are clear - UI changes including text should be trusted to the author. This is a pure UI suggestion with no functional impact. Delete the comment as it violates our rule about not commenting on UI changes.
14. packages/plugin-syncpolaris-ui/src/loanPolaris/components/index.tsx:6
  • Draft comment:
    Typographical: The import path './Collaterials' on line 6 seems like it might be a typo. If the intended file name is 'Collaterals', please update it accordingly.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% Since this is a new file, the import path is part of the changes. A typo in an import path could cause build failures, but those would be caught by the build system. The rules specifically state not to comment on things that would be obviously caught by the build, such as imports. If the import works, then the file name is correct; if it doesn't work, the build will fail. The typo could reflect a deeper inconsistency in file naming conventions that might be worth addressing. The build might actually work with either spelling on case-insensitive filesystems. While file naming consistency is important, this kind of import issue would be immediately apparent during development and caught by the build system. If it made it to PR, the import path must be correct. Delete the comment as it violates the rule about not commenting on things that would be caught by the build system, like import paths.

Workflow ID: wflow_t4R6hCyU2XAv6RRg

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.


let sendData: any = {
custCode: customer.code,
custCode: 'customer.code',
Copy link
Contributor

Choose a reason for hiding this comment

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

Avoid using a string literal for customer code; replace 'customer.code' with the actual dynamic value.

Suggested change
custCode: 'customer.code',
custCode: customer.code,

<Table>
<thead>
<tr>
<th>{__('Is Sync Collateral')}</th>
Copy link
Contributor

Choose a reason for hiding this comment

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

The table header Is Sync Collateral appears twice; consider renaming one (e.g., Collateral Certificate).

reSendCollateral
}: Props) {
const onSendCollateral = () =>
confirm(__('Are you sure Send Collateral?'))
Copy link
Contributor

Choose a reason for hiding this comment

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

Change the confirmation message from "Are you sure Send Collateral?" to "Are you sure you want to send collateral?" for clarity.

Suggested change
confirm(__('Are you sure Send Collateral?'))
confirm(__('Are you sure you want to send collateral?'))

contract: IContract;
}

function CollateralsInfo(props: IProps) {
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a potential typographical inconsistency: the file is named Collaterials.tsx but the component is named CollateralsInfo. Consider renaming the file to Collaterals.tsx for consistency.


function LoanActive({ contract, savingHistories, activeLoan }: Props) {
const onActive = () =>
confirm(__('Are you sure Active Loan?'))
Copy link
Contributor

Choose a reason for hiding this comment

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

The confirmation message 'Are you sure Active Loan?' seems unclear. Consider rephrasing it to improve clarity, e.g., 'Are you sure you want to activate this loan?'

Suggested change
confirm(__('Are you sure Active Loan?'))
confirm(__('Are you sure you want to activate this loan?'))


function PolarisSection({ contract, savingHistories, reSendContract }: Props) {
const onSendPolaris = () =>
confirm(__('Are you sure Send Loan polaris?'))
Copy link
Contributor

Choose a reason for hiding this comment

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

The confirmation message "Are you sure Send Loan polaris?" seems awkwardly phrased. Consider revising it to something like "Are you sure you want to send Loan Polaris?" to improve clarity.

Suggested change
confirm(__('Are you sure Send Loan polaris?'))
confirm(__('Are you sure you want to send Loan Polaris?'))


function ScheduleSection({ contract, reSendSchedules }: Props) {
const onSendSchedules = () =>
confirm(__('Are you sure Send Schedules?'))
Copy link
Contributor

Choose a reason for hiding this comment

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

Typographical suggestion: The confirmation message "Are you sure Send Schedules?" is awkward. Consider rephrasing it to something like "Are you sure you want to send schedules?" for clarity.

Suggested change
confirm(__('Are you sure Send Schedules?'))
confirm(__('Are you sure you want to send schedules?'))

}
`;

const ScrollTableColls = styled.div`
Copy link
Contributor

Choose a reason for hiding this comment

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

Typographical observation: The identifier ScrollTableColls might be a typo. Perhaps you meant ScrollTableCols for clarity?

export interface IList {
_id: string;
type?: string;
contantType?: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo: The property name contantType in the IList interface looks like it might be misspelled. Did you mean contentType?

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed 5fc47e3 in 1 minute and 29 seconds. Click for details.
  • Reviewed 1716 lines of code in 25 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. packages/plugin-savings-ui/src/contracts/graphql/mutations.ts:22
  • Draft comment:
    Missing commas in the 'commonFields' definition after $storeInterestInterval. Each variable definition should be separated by a comma to form valid GraphQL syntax.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
2. packages/plugin-savings-ui/src/contracts/graphql/mutations.ts:80
  • Draft comment:
    Mismatch in mutation call for contractsDealEdit: The mutation is declared as 'savingsContractsDealEdit' but internally calls 'savingsContractsEdit'. This may be a copy‐paste error.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
3. packages/plugin-savings-ui/src/contracts/components/detail/ContractDetails.tsx:34
  • Draft comment:
    Typo in prop names: 'constractId' and 'constractNumber' should likely be 'contractId' and 'contractNumber'.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_kter3faxQlOvaDRo

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed 2240298 in 2 minutes and 10 seconds. Click for details.
  • Reviewed 595 lines of code in 7 files
  • Skipped 0 files when reviewing.
  • Skipped posting 9 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. packages/plugin-savings-api/src/graphql/resolvers/mutations/contracts.ts:15
  • Draft comment:
    Removed trailing commas in object literals for style consistency. Verify that this matches project conventions.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
2. packages/plugin-savings-api/src/graphql/resolvers/mutations/contracts.ts:370
  • Draft comment:
    The permission key 'saingsContractsAdd' appears to be misspelled. Should this be 'savingsContractsAdd'?
  • Reason this comment was not posted:
    Comment was on unchanged code.
3. packages/plugin-savings-api/src/graphql/schema/contract.ts:161
  • Draft comment:
    Deprecated Polaris-related mutations have been removed from the schema. Ensure client-side queries are updated accordingly.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
4. packages/plugin-syncpolaris-api/src/graphql/resolvers/mutations/savings.ts:7
  • Draft comment:
    Passing the 'user' into createSavingMessage enhances context for logging. Ensure all required user details are available.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is asking the author to ensure that all required user details are available when passing the user into createSavingMessage. It is not a specific suggestion or a request for a test, but rather a general request for verification. This violates the rule against asking the author to ensure behavior is intended or tested.
5. packages/plugin-syncpolaris-api/src/utils/saving/activeSaving.ts:7
  • Draft comment:
    Consider renaming the 'params' parameter to something more descriptive (e.g., 'contractNumber') since it represents a contract identifier.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
6. packages/plugin-syncpolaris-api/src/utils/saving/createSavingMessage.ts:157
  • Draft comment:
    Using JSON.parse on savingCode may throw an error if the response is not valid JSON. Consider adding error handling or validating the format.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
7. packages/plugin-syncpolaris-api/src/utils/saving/updateSaving.ts:85
  • Draft comment:
    Magic numbers (e.g., 10, 1, 54) are used for fields like createdBy and modifiedBy. Replace them with named constants for clarity.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.
8. packages/plugin-syncpolaris-ui/src/savingPolaris/components/PolarisList.tsx:50
  • Draft comment:
    UI now references 'responseStr' instead of 'responseData'. Confirm that the backend consistently returns 'responseStr' for display purposes.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% This comment is asking the PR author to confirm that the backend consistently returns responseStr for display purposes. It is not a direct suggestion or a specific request for a test or code change. It violates the rule against asking the PR author to confirm their intention or ensure behavior is intended.
9. packages/plugin-savings-api/src/graphql/resolvers/mutations/contracts.ts:370
  • Draft comment:
    Typo: The permission string 'saingsContractsAdd' appears to be misspelled. It likely should be 'savingsContractsAdd'.
  • Reason this comment was not posted:
    Comment was on unchanged code.

Workflow ID: wflow_39gpd5uVZD3pguis

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed d4b9f01 in 1 minute and 21 seconds. Click for details.
  • Reviewed 102 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. packages/plugin-syncpolaris-ui/src/loanPolaris/components/PolarisSection.tsx:48
  • Draft comment:
    Removal of withConsumer HOC is fine if the component doesn’t rely on injected context. Ensure that any needed context is now provided via other means.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to ensure that the removal of a higher-order component (HOC) doesn't affect the component's functionality. This falls under asking the author to double-check or ensure behavior, which is against the rules.
2. packages/plugin-syncpolaris-ui/src/savingPolaris/components/PolarisSection.tsx:15
  • Draft comment:
    The 'currentUser' prop and its corresponding 'IUser' import are not used. Consider removing them to clean up the code.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_YFCxHdqHkqeS4pjp

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed 44da902 in 2 minutes and 15 seconds. Click for details.
  • Reviewed 227 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 7 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. packages/plugin-syncpolaris-api/src/utils/deposit/activeDeposit.ts:14
  • Draft comment:
    Potential type issue: passing entire 'params' as contentId instead of a specific contract number. Verify if this is intentional.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% The code is inconsistent - it uses the full params object in most places but params.number in updateContract. The 'any' type means we don't know the exact shape of params. While the suggestion might be correct, we don't have strong evidence about what params should contain or what contentId should be. The comment is speculative without more context about the params structure. We don't know if contentId should specifically be a number - it could be valid to store the full params object. The updateContract usage of params.number isn't definitive proof. While the inconsistency is suspicious, without knowing the requirements for contentId or the structure of params, we can't be confident enough that this is definitely wrong. Delete the comment since we don't have strong evidence that using the full params object is incorrect, and the comment is speculative asking for verification.
2. packages/plugin-syncpolaris-api/src/utils/deposit/activeDeposit.ts:17
  • Draft comment:
    Ensure sending full 'params' in consumeData (and in JSON.stringify) is intended versus using a specific field.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% This comment starts with "Ensure..." which is a red flag per our rules. It's asking the author to verify their intention rather than pointing out a clear issue. While the change from params.contractNumber to params is significant, we should assume the author made this change intentionally unless we see clear evidence of a problem. The change could potentially be storing more data than necessary in the logs, which might be inefficient or expose sensitive data. Without knowing the full context of what's in params or the requirements for logging, we can't definitively say this is wrong. The author likely had a reason for wanting to log the full params object. Delete this comment. It violates our rule about not asking authors to verify their intentions, and we don't have strong evidence that the change is incorrect.
3. packages/plugin-syncpolaris-api/src/utils/deposit/activeDeposit.ts:34
  • Draft comment:
    updateContract now uses { number: params }—confirm that 'params' is the correct value (e.g. a contract number) and not a full object.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the author to confirm that a specific value is correct. This is not a specific code suggestion or a request for a test, but rather a request for confirmation. According to the rules, comments asking for confirmation are not allowed.
4. packages/plugin-syncpolaris-api/src/utils/deposit/createDeposit.ts:15
  • Draft comment:
    Renaming the parameter to 'deposit' improves clarity; ensure its structure now consistently replaces the previous 'params.data'.
  • Reason this comment was not posted:
    Confidence changes required: 30% <= threshold 50% None
5. packages/plugin-syncpolaris-api/src/utils/deposit/createDeposit.ts:109
  • Draft comment:
    JSON.parse(depositCode) could throw if depositCode isn't valid JSON; consider adding error handling.
  • Reason this comment was not posted:
    Comment was on unchanged code.
6. packages/plugin-syncpolaris-api/src/utils/deposit/updateDeposit.ts:15
  • Draft comment:
    Parameter renamed to 'deposit'; verify that all expected fields (e.g. _id, number) are present in the passed object.
  • Reason this comment was not posted:
    Confidence changes required: 30% <= threshold 50% None
7. packages/plugin-syncpolaris-api/src/utils/deposit/updateDeposit.ts:107
  • Draft comment:
    Local variable 'updateDeposit' conflicts with the function name; consider renaming it to improve clarity.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_v17kr3HPrSLA23Zq

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed 5088f13 in 1 minute and 58 seconds. Click for details.
  • Reviewed 313 lines of code in 10 files
  • Skipped 0 files when reviewing.
  • Skipped posting 10 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. packages/plugin-syncpolaris-api/src/graphql/resolvers/mutations/loans.ts:11
  • Draft comment:
    Changed the type for the 'data' parameter from an array (any[]) to a single object (any). Verify that downstream functions (e.g. createLoanMessage, createCollateral, createLoanSchedule) expect an object and not an array.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to verify that downstream functions expect an object instead of an array. This falls under the category of asking the author to double-check things, which is against the rules. Therefore, this comment should not be approved.
2. packages/plugin-syncpolaris-api/src/graphql/resolvers/mutations/savings.ts:9
  • Draft comment:
    Changed the type for the 'data' parameter from any[] to any. Confirm that the expected structure is maintained for createSavingMessage.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to confirm that the expected structure is maintained after a type change. This falls under asking the author to confirm their intention or to ensure behavior, which is against the rules. Therefore, this comment should be removed.
3. packages/plugin-syncpolaris-api/src/utils/collateral/createCollateral.ts:18
  • Draft comment:
    Renamed the parameter from 'data' to 'loan' and updated the contentType from 'savings:contract' to 'loans:contract'. Ensure that all upstream callers now provide the full 'loan' object with the expected structure.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to ensure that all upstream callers provide the full loan object with the expected structure. This falls under the rule of not asking the author to ensure behavior is intended or tested. Therefore, this comment should be removed.
4. packages/plugin-syncpolaris-api/src/utils/loan/activeLoan.ts:11
  • Draft comment:
    The function now uses the contract number directly (params) instead of accessing a property (e.g. params.contractNumber). Verify that the contract number is passed in correctly from the mutation and is consistent with the filter used in updateContract.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 30% <= threshold 50% The comment is asking the author to verify that the contract number is passed correctly and is consistent with the filter used in another function. This is asking the author to double-check their work, which violates the rules. However, it does point out a specific change in the code, which could be useful if rephrased to suggest a specific action or ask for confirmation of intent.
5. packages/plugin-syncpolaris-api/src/utils/loan/createLoanMessage.ts:15
  • Draft comment:
    Renamed parameter from 'params' to 'loan' and updated the assignment for custCode (using customer.code now instead of a hardcoded value). Confirm that these changes align with backend expectations and that the caller is updated accordingly.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to confirm that the changes align with backend expectations and that the caller is updated accordingly. This falls under asking the author to confirm their intention or to ensure the behavior is intended, which is against the rules.
6. packages/plugin-syncpolaris-api/src/utils/loan/createSchedule.ts:34
  • Draft comment:
    Renamed the parameter from 'data' to 'contract' so that properties can be accessed directly. Ensure all callers provide the complete contract object as expected.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the author to ensure that all callers provide the complete contract object as expected. This falls under the rule of not asking the author to ensure behavior is intended or to double-check things. Therefore, this comment should be removed.
7. packages/plugin-syncpolaris-api/src/utils/loan/updateLoan.ts:15
  • Draft comment:
    Updated the function to receive 'loan' directly (instead of accessing loan from params). Double-check that the structure of the sendData array matches the backend API requirements.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the PR author to double-check the structure of the sendData array, which violates the rule against asking the author to confirm or double-check things. It does not provide a specific suggestion or point out a specific issue.
8. packages/plugin-syncpolaris-ui/src/loanPolaris/components/CollateralSection.tsx:40
  • Draft comment:
    Replaced usage of 'responseData' with 'responseStr' for determining sync status and message display. Also note the duplicate table header texts; confirm if this is intentional.
  • Reason this comment was not posted:
    Comment looked like it was already resolved.
9. packages/plugin-syncpolaris-ui/src/loanPolaris/containers/Collateral.tsx:23
  • Draft comment:
    The query now uses 'collateralId' from collateralsData instead of '_id'. Ensure that this matches the backend sync log record structure created in createCollateral.
  • Reason this comment was not posted:
    Comment did not seem useful. Confidence is useful = 0% <= threshold 50% The comment is asking the author to ensure that the change matches the backend sync log record structure. This falls under asking the author to ensure the behavior is intended, which is against the rules. Therefore, this comment should not be approved.
10. packages/plugin-syncpolaris-ui/src/loanPolaris/containers/Polaris.tsx:24
  • Draft comment:
    Refetch queries have been updated to include 'syncSavingsData'. Also, the savingHistory query now uses 'contract._id' as contentId. Confirm that using contract._id here is consistent with how sync logs are created (e.g. loan._id vs. collateralId) across the application.
  • Reason this comment was not posted:
    Comment was not on a location in the diff, so it can't be submitted as a review comment.

Workflow ID: wflow_KrnioBSVTbOEdWNX

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot
16.0% Duplication on New Code (required ≤ 3%)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@munkhsaikhan munkhsaikhan merged commit 6bae2ee into staging May 28, 2025
9 of 10 checks passed
@munkhsaikhan munkhsaikhan deleted the loans-improve branch May 28, 2025 16:16
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.

3 participants