Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process tracking update #998

Merged
merged 4 commits into from
Jul 2, 2024
Merged

Process tracking update #998

merged 4 commits into from
Jul 2, 2024

Conversation

ashish-egov
Copy link
Contributor

No description provided.

Copy link
Contributor

coderabbitai bot commented Jul 2, 2024

Walkthrough

Walkthrough

The codebase underwent significant restructuring, focusing on refining process tracking. Key updates include renaming and reorganizing constants into processTrackTypes and processTrackStatuses, enhancing handling of ResourceDetails, and updating tracking statuses in various utilities. Redundant calls were removed to streamline operations, and new functions like createProcessTracks were introduced for better process management.

Changes

File Change Summary
.../api/campaignApis.ts Fixed array check, updated ResourceDetails handling, modified process tracks logic
.../api/genericApis.ts Renamed and expanded process tracks constants, added campaignId parameter, updated tracking logic
.../config/constants.ts Split processTracks into processTrackTypes and processTrackStatuses, expanded and redefined
.../kafka/Listener.ts Formatting adjustments, no logic change
.../utils/campaignMappingUtils.ts Removed import and call of persistTrack
.../utils/campaignUtils.ts Restructured process track handling functions, updated persistTrack, introduced createProcessTracks
.../utils/processTrackUtils.ts Refactored getProcessDetails, updated persistTrack, added createProcessTracks

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant API as campaignApis.ts
    participant Constants as constants.ts
    participant Utils as processTrackUtils.ts

    Client->>API: POST /createProjectCampaign
    API->>Constants: Import processTrackTypes, processTrackStatuses
    API->>API: Check request.body.Activities
    API->>Utils: Check ResourceDetails for facility and user
    Utils->>Constants: Import processTrackTypes, processTrackStatuses
    Utils->>Utils: Update process tracks
    API->>Client: Return updated campaign response
Loading

Poem

In lines of code that shape the stream,
Constants split and processes gleam.
Tracks align, we've redefined,
With ResourceDetails that intertwine.
🎩 A rabbit coded, swift and spry,
Making changes that fly high. 🐇


Tip

Early access features: enabled

We are currently testing the following features in early access:

  • OpenAI gpt-4o model for code reviews and chat: OpenAI claims that this model is better at understanding and generating code than the previous models. We seek your feedback over the next few weeks before making it generally available.

Note:

  • You can enable or disable early access features from the CodeRabbit UI or by updating the CodeRabbit configuration file.
  • Please join our Discord Community to provide feedback and report issues.
  • OSS projects are currently opted into early access features by default.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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.

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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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

@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: 3

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e9e6508 and e80f0c5.

Files selected for processing (7)
  • utilities/project-factory/src/server/api/campaignApis.ts (5 hunks)
  • utilities/project-factory/src/server/api/genericApis.ts (5 hunks)
  • utilities/project-factory/src/server/config/constants.ts (1 hunks)
  • utilities/project-factory/src/server/kafka/Listener.ts (4 hunks)
  • utilities/project-factory/src/server/utils/campaignMappingUtils.ts (3 hunks)
  • utilities/project-factory/src/server/utils/campaignUtils.ts (7 hunks)
  • utilities/project-factory/src/server/utils/processTrackUtils.ts (2 hunks)
Files skipped from review due to trivial changes (1)
  • utilities/project-factory/src/server/kafka/Listener.ts
Additional context used
Biome
utilities/project-factory/src/server/utils/processTrackUtils.ts

[error] 77-77: This var should be declared at the root of the enclosing function.

The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.

(lint/correctness/noInnerDeclarations)

utilities/project-factory/src/server/config/constants.ts

[error] 1-1: Do not shadow the global "Error" property.

Consider renaming this variable. It's easy to confuse the origin of variables when they're named after a known global.

(lint/suspicious/noShadowRestrictedNames)

utilities/project-factory/src/server/utils/campaignMappingUtils.ts

[error] 51-51: This var should be declared at the root of the enclosing function.

The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.

(lint/correctness/noInnerDeclarations)


[error] 53-53: This var should be declared at the root of the enclosing function.

The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.

(lint/correctness/noInnerDeclarations)


[error] 206-206: This var should be declared at the root of the enclosing function.

The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.

(lint/correctness/noInnerDeclarations)


[error] 207-207: This var should be declared at the root of the enclosing function.

The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.

(lint/correctness/noInnerDeclarations)


[error] 209-209: This var should be declared at the root of the enclosing function.

The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.

(lint/correctness/noInnerDeclarations)


[error] 219-232: This else clause can be omitted because previous branches break early.

Unsafe fix: Omit the else clause.

(lint/style/noUselessElse)


[error] 224-232: This else clause can be omitted because previous branches break early.

(lint/style/noUselessElse)


[error] 229-232: This else clause can be omitted because previous branches break early.

(lint/style/noUselessElse)


[error] 235-235: This var should be declared at the root of the enclosing function.

The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.

(lint/correctness/noInnerDeclarations)

utilities/project-factory/src/server/api/genericApis.ts

[error] 67-69: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 657-689: This else clause can be omitted because previous branches break early.

Unsafe fix: Omit the else clause.

(lint/style/noUselessElse)


[error] 659-659: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 675-675: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 686-688: This else clause can be omitted because previous branches break early.

Unsafe fix: Omit the else clause.

(lint/style/noUselessElse)


[error] 841-841: Unsafe usage of optional chaining.

If it short-circuits with 'undefined' the evaluation will throw TypeError here:

(lint/correctness/noUnsafeOptionalChaining)


[error] 876-876: Unsafe usage of optional chaining.

If it short-circuits with 'undefined' the evaluation will throw TypeError here:

(lint/correctness/noUnsafeOptionalChaining)


[error] 878-878: Unsafe usage of optional chaining.

If it short-circuits with 'undefined' the evaluation will throw TypeError here:

(lint/correctness/noUnsafeOptionalChaining)


[error] 882-882: This var should be declared at the root of the enclosing function.

The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.

(lint/correctness/noInnerDeclarations)


[error] 972-972: This var should be declared at the root of the enclosing function.

The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.

(lint/correctness/noInnerDeclarations)


[error] 973-973: This var should be declared at the root of the enclosing function.

The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.

(lint/correctness/noInnerDeclarations)


[error] 246-246: Don't use 'String' as a type.

Use lowercase primitives for consistency.
Safe fix: Use 'string' instead

(lint/complexity/noBannedTypes)


[error] 287-287: Don't use 'String' as a type.

Use lowercase primitives for consistency.
Safe fix: Use 'string' instead

(lint/complexity/noBannedTypes)

utilities/project-factory/src/server/api/campaignApis.ts

[error] 29-29: Unsafe usage of optional chaining.

If it short-circuits with 'undefined' the evaluation will throw TypeError here:

(lint/correctness/noUnsafeOptionalChaining)


[error] 39-39: Unsafe usage of optional chaining.

If it short-circuits with 'undefined' the evaluation will throw TypeError here:

(lint/correctness/noUnsafeOptionalChaining)


[error] 41-44: This else clause can be omitted because previous branches break early.

Unsafe fix: Omit the else clause.

(lint/style/noUselessElse)


[error] 234-234: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 240-240: This var should be declared at the root of the enclosing function.

The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.

(lint/correctness/noInnerDeclarations)


[error] 244-244: Unsafe usage of optional chaining.

If it short-circuits with 'undefined' the evaluation will throw TypeError here:

(lint/correctness/noUnsafeOptionalChaining)


[error] 278-278: Unsafe usage of optional chaining.

If it short-circuits with 'undefined' the evaluation will throw TypeError here:

(lint/correctness/noUnsafeOptionalChaining)


[error] 357-357: Unsafe usage of optional chaining.

If it short-circuits with 'undefined' the evaluation will throw TypeError here:

(lint/correctness/noUnsafeOptionalChaining)


[error] 480-480: Change to an optional chain.

Unsafe fix: Change to an optional chain.

(lint/complexity/useOptionalChain)


[error] 554-554: This var should be declared at the root of the enclosing function.

The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.

(lint/correctness/noInnerDeclarations)


[error] 673-673: This var should be declared at the root of the enclosing function.

The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.

(lint/correctness/noInnerDeclarations)


[error] 687-687: This var should be declared at the root of the enclosing function.

The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.

(lint/correctness/noInnerDeclarations)


[error] 694-694: This var should be declared at the root of the enclosing function.

The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.

(lint/correctness/noInnerDeclarations)


[error] 720-720: This var should be declared at the root of the enclosing function.

The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.

(lint/correctness/noInnerDeclarations)


[error] 721-721: This var should be declared at the root of the enclosing function.

The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.

(lint/correctness/noInnerDeclarations)


[error] 868-868: Unsafe usage of optional chaining.

If it short-circuits with 'undefined' the evaluation will throw TypeError here:

(lint/correctness/noUnsafeOptionalChaining)

utilities/project-factory/src/server/utils/campaignUtils.ts

[error] 415-415: This var should be declared at the root of the enclosing function.

The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.

(lint/correctness/noInnerDeclarations)


[error] 451-451: Unsafe usage of optional chaining.

If it short-circuits with 'undefined' the evaluation will throw TypeError here:

(lint/correctness/noUnsafeOptionalChaining)


[error] 502-502: Unsafe usage of optional chaining.

If it short-circuits with 'undefined' the evaluation will throw TypeError here:

(lint/correctness/noUnsafeOptionalChaining)


[error] 545-545: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 574-574: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 576-576: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 614-614: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 616-616: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 617-617: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 631-634: This var should be declared at the root of the enclosing function.

The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.

(lint/correctness/noInnerDeclarations)


[error] 648-648: This var should be declared at the root of the enclosing function.

The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.

(lint/correctness/noInnerDeclarations)


[error] 759-761: This else clause can be omitted because previous branches break early.

Unsafe fix: Omit the else clause.

(lint/style/noUselessElse)


[error] 874-874: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 881-881: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 882-882: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 883-883: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 884-884: Avoid the delete operator which can impact performance.

Unsafe fix: Use an undefined assignment instead.

(lint/performance/noDelete)


[error] 1078-1078: Unsafe usage of optional chaining.

If it short-circuits with 'undefined' the evaluation will throw TypeError here:

(lint/correctness/noUnsafeOptionalChaining)


[error] 1100-1103: This var should be declared at the root of the enclosing function.

The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.

(lint/correctness/noInnerDeclarations)


[error] 1104-1104: This var should be declared at the root of the enclosing function.

The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.

(lint/correctness/noInnerDeclarations)

Additional comments not posted (14)
utilities/project-factory/src/server/utils/processTrackUtils.ts (6)

27-28: Ensure the filtering logic is correct.

The filtering logic for processTrackTypes.error and processTrackStatuses.toBeCompleted seems appropriate.


Line range hint 42-66: LGTM!

The code changes are approved.

Tools
Biome

[error] 77-77: This var should be declared at the root of the enclosing function.

The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.

(lint/correctness/noInnerDeclarations)


70-91: Verify processTrackTypes and processTrackStatuses.

Ensure that the processTrackTypes and processTrackStatuses used in the function are correct.

Verification successful

Verified processTrackTypes and processTrackStatuses.

The processTrackTypes and processTrackStatuses used in the createProcessTracks function are correctly defined and used.

  • processTrackTypes and processTrackStatuses definitions found in utilities/project-factory/src/server/config/constants.ts.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the `processTrackTypes` and `processTrackStatuses` values.

# Test: Search for the `processTrackTypes` and `processTrackStatuses` definitions in the codebase.
rg --type ts $'processTrackTypes'
rg --type ts $'processTrackStatuses'

Length of output: 8054



Script:

#!/bin/bash
# Extract the definitions of processTrackTypes and processTrackStatuses from constants.ts
rg --multiline --multiline-dotall --context 10 'export const processTrackTypes' utilities/project-factory/src/server/config/constants.ts
rg --multiline --multiline-dotall --context 10 'export const processTrackStatuses' utilities/project-factory/src/server/config/constants.ts

Length of output: 1655

Tools
Biome

[error] 77-77: This var should be declared at the root of the enclosing function.

The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.

(lint/correctness/noInnerDeclarations)


Line range hint 42-66: Verify Kafka topic configuration.

Ensure that the Kafka topic KAFKA_UPDATE_PROCESS_TRACK_TOPIC is correctly configured.

Verification successful

Kafka topic configuration is set correctly.

The Kafka topic KAFKA_UPDATE_PROCESS_TRACK_TOPIC is configured in the environment variables with a default value of "update-process-track".

  • utilities/project-factory/src/server/config/index.ts: KAFKA_UPDATE_PROCESS_TRACK_TOPIC: process.env.KAFKA_UPDATE_PROCESS_TRACK_TOPIC || "update-process-track",
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the Kafka topic configuration.

# Test: Search for the Kafka topic configuration in the codebase.
rg --type json $'KAFKA_UPDATE_PROCESS_TRACK_TOPIC'

Length of output: 49



Script:

#!/bin/bash
# Description: Verify the Kafka topic configuration in various file types.

# Test: Search for the Kafka topic configuration in the codebase.
rg 'KAFKA_UPDATE_PROCESS_TRACK_TOPIC' --type json --type yaml --type yml --type js --type ts --type env

Length of output: 131



Script:

#!/bin/bash
# Description: Verify the Kafka topic configuration in various file types.

# Test: Search for the Kafka topic configuration in the codebase.
rg 'KAFKA_UPDATE_PROCESS_TRACK_TOPIC' --type json --type yaml --type js --type ts --type env

Length of output: 120



Script:

#!/bin/bash
# Description: Verify the Kafka topic configuration in various file types.

# Test: Search for the Kafka topic configuration in the codebase.
rg 'KAFKA_UPDATE_PROCESS_TRACK_TOPIC' --type json --type yaml --type js --type ts

Length of output: 383

Tools
Biome

[error] 77-77: This var should be declared at the root of the enclosing function.

The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.

(lint/correctness/noInnerDeclarations)


70-91: Verify Kafka topic configuration.

Ensure that the Kafka topic KAFKA_SAVE_PROCESS_TRACK_TOPIC is correctly configured.

Verification successful

Kafka topic configuration is verified.

The Kafka topic KAFKA_SAVE_PROCESS_TRACK_TOPIC is correctly configured with a fallback value.

  • utilities/project-factory/src/server/config/index.ts: KAFKA_SAVE_PROCESS_TRACK_TOPIC: process.env.KAFKA_SAVE_PROCESS_TRACK_TOPIC || "save-process-track"
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the Kafka topic configuration.

# Test: Search for the Kafka topic configuration in the codebase.
rg --type json $'KAFKA_SAVE_PROCESS_TRACK_TOPIC'

Length of output: 47



Script:

#!/bin/bash
# Description: Verify the Kafka topic configuration.

# Test: Search for the Kafka topic configuration in common configuration files.
rg 'KAFKA_SAVE_PROCESS_TRACK_TOPIC' --type js --type ts --type env --type yaml --type yml --type toml --type ini

Length of output: 140



Script:

#!/bin/bash
# Description: Verify the Kafka topic configuration.

# Test: Search for the Kafka topic configuration in common configuration files.
rg 'KAFKA_SAVE_PROCESS_TRACK_TOPIC' --type js --type ts --type yaml --type yml --type toml --type ini --type json

# Additionally search for the topic in .env files without specifying the type.
rg 'KAFKA_SAVE_PROCESS_TRACK_TOPIC' --glob '*.env'

Length of output: 341



Script:

#!/bin/bash
# Description: Verify the Kafka topic configuration.

# Test: Search for the Kafka topic configuration in common configuration files.
rg 'KAFKA_SAVE_PROCESS_TRACK_TOPIC' --type js --type ts --type yaml --type toml --type ini --type json

# Additionally search for the topic in .env files with debug information.
rg 'KAFKA_SAVE_PROCESS_TRACK_TOPIC' --glob '*.env' --debug

Length of output: 76852



Script:

#!/bin/bash
# Description: Verify the Kafka topic configuration.

# Test: Search for the Kafka topic configuration in common configuration files.
rg 'KAFKA_SAVE_PROCESS_TRACK_TOPIC' --type js --type ts --type yaml --type toml --type json --glob '*.env'

# Additionally search for the topic in all files to ensure coverage.
rg 'KAFKA_SAVE_PROCESS_TRACK_TOPIC'

Length of output: 577

Tools
Biome

[error] 77-77: This var should be declared at the root of the enclosing function.

The var is accessible in the whole body of the enclosing function.
To avoid confusion, it should be declared at the root of the enclosing function.

(lint/correctness/noInnerDeclarations)


7-38: Verify correctness of the query logic.

The query logic changes look good but ensure that the table name and column names are correct.

utilities/project-factory/src/server/config/constants.ts (2)

112-122: LGTM!

The processTrackTypes constant is correctly defined.


124-128: LGTM!

The processTrackStatuses constant is correctly defined.

utilities/project-factory/src/server/api/campaignApis.ts (4)

16-16: Approved: Import statement change.

The import statement for processTrackStatuses and processTrackTypes from ../config/constants is correct.


791-791: Approved: Added delay before producing modified messages.

The change introduces a 2-second delay if there are activities in the request body. Ensure that this delay is necessary and consider optimizing it if possible.


814-816: Approved: Added call to persistTrack for facilities.

The call to persistTrack ensures that the process track for facilities is marked as completed. Verify if persistTrack handles errors correctly.


842-848: Approved: Added call to persistTrack for user creation.

The call to persistTrack ensures that the process track for user creation is marked as in-progress. Verify if persistTrack handles errors correctly.

utilities/project-factory/src/server/utils/campaignUtils.ts (2)

544-544: Verify the usage of persistTrack function.

Ensure that the persistTrack function is correctly used and that the added functionality aligns with the overall logic of the function.

Verification successful

The usage of persistTrack function is correctly implemented.

The persistTrack function is defined in utilities/project-factory/src/server/utils/processTrackUtils.ts and is used appropriately in campaignUtils.ts. The parameters passed to persistTrack align with its definition and intended functionality.

  • utilities/project-factory/src/server/utils/processTrackUtils.ts: Definition of persistTrack.
  • utilities/project-factory/src/server/utils/campaignUtils.ts: Usage of persistTrack.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the implementation of `persistTrack` function.

# Test: Search for the function implementation. Expect: Correct usage of `persistTrack`.
ast-grep --lang typescript --pattern $'function persistTrack($_, $_, $_, $_) {
  $$$
}'

Length of output: 88



Script:

#!/bin/bash
# Search for the definition of `persistTrack` function in the codebase
ast-grep --lang typescript --pattern 'function persistTrack($_, $_, $_, $_) {
  $$$
}'

# Search for any import statements of `persistTrack` in the codebase
rg 'persistTrack' --type ts

Length of output: 3464



Script:

#!/bin/bash
# Extract the implementation of `persistTrack` function from `processTrackUtils.ts`
ast-grep --lang typescript --pattern 'async function persistTrack($_, $_, $_, $_) {
  $$$
}' utilities/project-factory/src/server/utils/processTrackUtils.ts

Length of output: 158



Script:

#!/bin/bash
# Search for the definition of `persistTrack` function in the codebase with surrounding context
rg 'async function persistTrack' -A 10 utilities/project-factory/src/server/utils/processTrackUtils.ts

Length of output: 383


673-673: Verify the usage of createProcessTracks function.

Ensure that the createProcessTracks function is correctly used and that the added functionality aligns with the overall logic of the function.

Verification successful

Verify the usage of createProcessTracks function.

The createProcessTracks function is correctly used in the enrichAndPersistProjectCampaignForFirst function. It is called after handling campaign creation or update, which aligns with the overall logic of the function.

  • utilities/project-factory/src/server/utils/campaignUtils.ts: 673
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the implementation of `createProcessTracks` function.

# Test: Search for the function implementation. Expect: Correct usage of `createProcessTracks`.
ast-grep --lang typescript --pattern $'function createProcessTracks($_) {
  $$$
}'

Length of output: 2514



Script:

#!/bin/bash
# Description: Verify the context and usage of `createProcessTracks` in `enrichAndPersistProjectCampaignForFirst`.

# Search for the `enrichAndPersistProjectCampaignForFirst` function implementation.
ast-grep --lang typescript --pattern $'function enrichAndPersistProjectCampaignForFirst($_) {
  $$$
}' --json

# Search for all calls to `createProcessTracks` to see how it's used.
rg 'createProcessTracks'

Length of output: 611



Script:

#!/bin/bash
# Description: List all function definitions in `campaignUtils.ts` to locate the correct function.

# List all function definitions in `campaignUtils.ts`.
ast-grep --lang typescript --pattern 'function $_($_) {
  $$$
}' --json utilities/project-factory/src/server/utils/campaignUtils.ts

Length of output: 28144



Script:

#!/bin/bash
# Description: Extract lines around the `createProcessTracks` call in `campaignUtils.ts` to understand the context.

# Extract lines around the `createProcessTracks` call in `campaignUtils.ts`.
sed -n '663,683p' utilities/project-factory/src/server/utils/campaignUtils.ts

Length of output: 1149

@jagankumar-egov jagankumar-egov merged commit ca1d3db into campaign Jul 2, 2024
3 of 4 checks passed
@jagankumar-egov jagankumar-egov deleted the processTrackingUpdate branch July 2, 2024 06:11
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