Skip to content

Updated the state code for orissa#1056

Merged
belwalshubham merged 1 commit intomainfrom
feat/update-state-code
Mar 3, 2025
Merged

Updated the state code for orissa#1056
belwalshubham merged 1 commit intomainfrom
feat/update-state-code

Conversation

@belwalshubham
Copy link
Copy Markdown
Collaborator

@belwalshubham belwalshubham commented Mar 3, 2025

Summary by CodeRabbit

  • Refactor

    • Removed monetary contribution tabs from several service interfaces to streamline available options.
    • Updated access controls to grant an additional administrative role for monetary contributions.
    • Modified the display logic so that the monetary contribution link now appears only on event-related pages.
  • Chores

    • Updated a configuration setting for improved consistency.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 3, 2025

Walkthrough

This PR modifies how monetary contribution functionalities are handled across multiple components. Several service classes now have the tab configurations for 'monetaryContribution' and 'monetaryContributionForUrbanOps' commented out, effectively removing them from the user interface. In one service, the permissions for the 'monetaryContribution' tab are updated to include an additional role. Additionally, a key in the constants file is changed from 'OD' to 'OR', and the Goonj Blocks plugin now conditionally renders the monetary contribution link only when the target is 'events'.

Changes

File(s) Change Summary
wp-content/.../Civi/DroppingCenterService.php, wp-content/.../Civi/GoonjActivitiesService.php, wp-content/.../Civi/InstitutionCollectionCampService.php,
wp-content/.../Civi/InstitutionDroppingCenterService.php, wp-content/.../Civi/InstitutionGoonjActivitiesService.php
Commented out the configurations for 'monetaryContribution' and 'monetaryContributionForUrbanOps' tabs, removing these options from the UI.
wp-content/.../Civi/GoonjInitiatedEventsService.php Updated the permissions array for the 'monetaryContribution' tab to include 'urban_ops_admin' in addition to the existing roles.
wp-content/.../config/constants.php Changed the mapping key from 'OD' to 'OR' while keeping the value 'ORS' unchanged.
wp-content/plugins/goonj-blocks/{build,src}/render.php Altered the rendering logic to conditionally display the monetary contribution link only when the $target variable is equal to 'events'.

Sequence Diagram(s)

sequenceDiagram
    participant Browser
    participant PluginRenderer
    Browser->>PluginRenderer: Request page render with target value
    Note over PluginRenderer: Check if target equals 'events'
    alt target is 'events'
        PluginRenderer->>Browser: Render the monetary contribution link
    else target not 'events'
        PluginRenderer->>Browser: Omit the monetary contribution link
    end
Loading

Possibly related PRs

  • Open monetary on staging site #860 – This PR comments out tab configurations for monetary contributions, directly relating to a PR that reintroduces those configurations.
  • Add Monetary Contribution Tabs #441 – Involves contrasting modifications: commenting out existing tab configurations versus adding new ones for monetary contributions.
  • Hide monetary #1022 – Both PRs remove similar tab configurations for monetary contributions, affecting the related UI and permissions.

Suggested labels

status : ready for review

Suggested reviewers

  • tarunnjoshi

Poem

In the code where tabs once stood,
Monetary links faded as they should.
Permissions expanded in a quiet tune,
Constants remapped beneath a digital moon.
A neat commit with a joyful cheer – code refined and clear! 🎉
Happy coding!

✨ Finishing Touches
  • 📝 Generate Docstrings

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

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 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.

@belwalshubham belwalshubham changed the base branch from develop to main March 3, 2025 07:53
@belwalshubham belwalshubham self-assigned this Mar 3, 2025
Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
wp-content/civi-extensions/goonjcustom/config/constants.php (1)

7-44: Consider adding documentation for this constants mapping

The file contains an array mapping two-letter state codes to three-letter codes without explaining their purpose or usage context. This makes maintenance challenging as developers must infer the purpose of these mappings.

Add a descriptive comment at the top of the array to explain:

  1. What these mappings represent
  2. Where they're used in the application
  3. Any standards they adhere to
 return [
+  // Mapping of two-letter state codes to three-letter state codes for Indian states and union territories
+  // Used for data standardization across the Goonj application and external integrations
+  // Reference: [Add reference to the standard being followed]
   'AN' => 'ANN',
   'AP' => 'APD',
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 69e4102 and 1d17dcd.

📒 Files selected for processing (9)
  • wp-content/civi-extensions/goonjcustom/Civi/DroppingCenterService.php (1 hunks)
  • wp-content/civi-extensions/goonjcustom/Civi/GoonjActivitiesService.php (1 hunks)
  • wp-content/civi-extensions/goonjcustom/Civi/GoonjInitiatedEventsService.php (1 hunks)
  • wp-content/civi-extensions/goonjcustom/Civi/InstitutionCollectionCampService.php (1 hunks)
  • wp-content/civi-extensions/goonjcustom/Civi/InstitutionDroppingCenterService.php (1 hunks)
  • wp-content/civi-extensions/goonjcustom/Civi/InstitutionGoonjActivitiesService.php (1 hunks)
  • wp-content/civi-extensions/goonjcustom/config/constants.php (1 hunks)
  • wp-content/plugins/goonj-blocks/build/render.php (1 hunks)
  • wp-content/plugins/goonj-blocks/src/render.php (1 hunks)
✅ Files skipped from review due to trivial changes (5)
  • wp-content/civi-extensions/goonjcustom/Civi/InstitutionGoonjActivitiesService.php
  • wp-content/civi-extensions/goonjcustom/Civi/DroppingCenterService.php
  • wp-content/civi-extensions/goonjcustom/Civi/InstitutionDroppingCenterService.php
  • wp-content/civi-extensions/goonjcustom/Civi/InstitutionCollectionCampService.php
  • wp-content/civi-extensions/goonjcustom/Civi/GoonjActivitiesService.php
🔇 Additional comments (4)
wp-content/civi-extensions/goonjcustom/Civi/GoonjInitiatedEventsService.php (1)

257-257: Role addition looks good

The addition of 'urban_ops_admin' to the permissions array is well-implemented and follows the pattern established for other tabs in this file.

wp-content/plugins/goonj-blocks/build/render.php (1)

347-351: Appropriate conditional implementation for monetary contributions

The conditional rendering of the Monetary Contribution link only for events is correctly implemented. This change aligns with what appears to be a broader initiative to restrict monetary contribution functionality to specific contexts.

wp-content/plugins/goonj-blocks/src/render.php (1)

347-351: Identical implementation in source file looks good

This conditional rendering matches the implementation in the build file, ensuring consistency between source and compiled versions.

wp-content/civi-extensions/goonjcustom/config/constants.php (1)

33-33:

Details

✅ Verification successful

State code updated from 'OD' to 'OR' for Odisha (formerly Orissa)

This change updates the two-letter state code from 'OD' to 'OR' while maintaining the three-letter code 'ORS'. This appears to be reverting to the pre-2011 code, as the state was officially renamed from Orissa to Odisha in 2011, when the code was updated to 'OD'.

Consider adding a comment explaining the reason for this change to help future maintainers understand the context:

-  'OR' => 'ORS',
+  'OR' => 'ORS', // Updated from 'OD' as per standardization requirements

🌐 Web query:

What is the current official two-letter state code for Odisha (formerly Orissa) in India?

💡 Result:

The current official two-letter state code for Odisha (formerly Orissa) in India is OR. This abbreviation is consistently used across Indian government sources, including tax documents and administrative codes[1][6][10].

While international standards like ISO 3166-2 use OD for Odisha[8], the Indian government's official state codes retain OR post the state's renaming in 2011. For example:

  • The Department of Revenue lists Odisha's code as OR[6]
  • The Bullseye Locations database shows OR as the primary abbreviation[2]
  • Historical references in nomenclatures also maintain OR for Odisha[1]

This distinction arises because India's internal administrative codes (e.g., TIN numbering, state abbreviations) haven't been updated to align with ISO standards following the name change from Orissa to Odisha[4][6].

Citations:


PR Check – Official State Code Update Verified

The code change to use 'OR' => 'ORS', is correct. The web query confirms that the Indian government's official two-letter state code for Odisha is indeed OR. There are no violations of coding best practices here—no duplicate code, unreadable sections, or single responsibility issues.

A small improvement suggestion: consider adding an inline comment to clarify why the change was made. For example:

-  'OR' => 'ORS',
+  'OR' => 'ORS', // Updated from 'OD' to 'OR' per Indian government standards for Odisha

@belwalshubham belwalshubham merged commit 3b0a16d into main Mar 3, 2025
@belwalshubham belwalshubham deleted the feat/update-state-code branch March 3, 2025 07:55
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.

1 participant