Skip to content

Conversation

@sharifajahanshaik
Copy link
Contributor

@sharifajahanshaik sharifajahanshaik commented Dec 29, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Improved Indian rupee currency formatting to properly handle zero and negative amounts, which now consistently display as "0 rupees" for clearer results.
    • Enhanced currency amount formatting to provide more reliable and consistent display of large rupee values across crore, lakh, thousand, and other denominations.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 29, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

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.

Walkthrough

Refactoring of Indian number formatting utility that replaces position-based digit processing with fixed-width decomposition into crore, lakh, thousand, and hundred units, expanding zero/negative handling and simplifying the aggregation logic.

Changes

Cohort / File(s) Summary
Indian number formatting refactor
app/ai/voice/agents/breeze_buddy/utils/common.py
Replaced per-digit/position-based formatting with arithmetic decomposition into crore, lakh, thousand, hundred, and remainder components. Broadened non-positive input handling (≤0 instead of <100). Removed string slicing and dynamic insertion logic in favor of straightforward component aggregation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A rabbit once counted with flair,
Breaking numbers with mathematical care,
Crore, lakh, thousand, all in a row,
No more string-slicing, just let the math flow!
The rupees now format with elegant grace,
Our formatting code found its better place.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: indian_number_to_speech function' is directly related to the main change—refactoring the Indian number formatting logic in the specified 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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@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)
app/ai/voice/agents/breeze_buddy/utils/common.py (1)

31-44: Function naming is somewhat misleading; consider adding documentation or clarifying the name.

The function returns a hybrid format with numeric digits and Indian unit terms (e.g., "5 crore 23 lakh 45 rupees") rather than full word conversion. While this works well for TTS systems like your voice agent (the variable is aptly named price_words in websocket_bot.py), the function name indian_number_to_speech doesn't clearly reflect that it preserves numeric digits. Add a docstring explaining this behavior, or consider a more accurate name like indian_number_format_for_speech to reduce confusion for future developers.

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ef71043 and 530c760.

📒 Files selected for processing (1)
  • app/ai/voice/agents/breeze_buddy/utils/common.py
🔇 Additional comments (3)
app/ai/voice/agents/breeze_buddy/utils/common.py (3)

14-15: Improved zero/negative handling.

The change from number < 100 to number <= 0 is a good improvement that properly handles edge cases for non-positive amounts.


19-30: Clean decomposition implementation.

The fixed-width decomposition approach using integer division and modulo operations is mathematically correct and easier to reason about than position-based processing.


46-46: Return statement is correct.

The join and format logic properly handles all valid cases, including edge cases where only the final remainder (1-99) exists.

@sharifajahanshaik sharifajahanshaik force-pushed the fix-indian_number_to_speech-function-for-all-cases branch from 530c760 to 6c38ea6 Compare January 12, 2026 12:12
@swaroopvarma1 swaroopvarma1 merged commit aca7a77 into juspay:release Jan 12, 2026
2 checks passed
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