Skip to content

Add support for Brazilian Real currency#619

Open
ccesario wants to merge 1 commit into
PegaProx:mainfrom
ccesario:patch-1
Open

Add support for Brazilian Real currency#619
ccesario wants to merge 1 commit into
PegaProx:mainfrom
ccesario:patch-1

Conversation

@ccesario

@ccesario ccesario commented Jul 17, 2026

Copy link
Copy Markdown

User description

Add the Brazilian Real Currency R$ in cost dashboard


CodeAnt-AI Description

Add Brazilian Real support in the cost dashboard

What Changed

  • The cost dashboard now recognizes Brazilian Real in cost displays and summaries
  • BRL can now be selected as a currency option in the dashboard

Impact

✅ Cost shown in BRL
✅ Easier use for Brazilian users
✅ Fewer unsupported-currency displays

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

Add the Brazilian Real Currency R$ in cost dashboard
@codeant-ai-for-open-source codeant-ai-for-open-source Bot added the size:XS This PR changes 0-9 lines, ignoring generated files label Jul 17, 2026
@qodo-code-review

Copy link
Copy Markdown

PR Summary by Qodo

Add BRL (R$) currency support to cost dashboard

✨ Enhancement 🕐 Less than 10 minutes

Grey Divider

AI Description

• Add BRL as a selectable currency for cost rate configuration.
• Render BRL using the "R$" symbol in cost totals formatting.
• Ensure BRL is handled consistently across cost/power PDF exports.
Diagram

graph TD
  U["User"] --> UI["Cost dashboard UI"] --> SEL["Currency selector"] --> FMT["Currency formatting"] --> OUT["UI + exports"]
  UI --> API[("/cost/rates API")]

  subgraph Legend
    direction LR
    _usr["Actor"] ~~~ _ui["UI component"] ~~~ _api[("API endpoint")]
  end
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Centralize currency mapping constants
  • ➕ Avoids duplicating currency code/symbol maps across multiple formatter functions
  • ➕ Makes adding future currencies a one-line change
  • ➕ Reduces risk of inconsistent symbols between UI and exports
  • ➖ Slight refactor in a large file; may touch more lines than this minimal change
2. Use Intl.NumberFormat for currency formatting
  • ➕ Correct locale-aware formatting (symbol placement, separators, decimals)
  • ➕ Eliminates manual symbol maps for most currencies
  • ➖ Requires deciding locale strategy (user locale vs fixed)
  • ➖ Might change existing formatting output and tests/screenshots (if any)

Recommendation: The current incremental approach is fine for a single added currency, but the file already has multiple currency maps (code vs symbol) in different places. Consider a small follow-up to centralize the currency metadata (code + symbol) in one constant (or helper) to prevent future drift; adopting Intl.NumberFormat is a bigger behavioral change best handled separately.

Files changed (1) +4 / -3

Enhancement (1) +4 / -3
dashboard.jsAdd BRL currency symbol/code mappings and dropdown option +4/-3

Add BRL currency symbol/code mappings and dropdown option

• Extends existing currency mapping tables to recognize BRL in both display formatting and PDF export formatting. Adds BRL (R$) to the currency selector used when configuring cost rates.

web/src/dashboard.js

Comment thread web/src/dashboard.js
const fmt = (n) => {
const cur = summary?.rates?.currency || 'EUR';
const sym = ({ EUR: '€', USD: '$', GBP: '£', CHF: 'CHF', JPY: '¥' }[cur] || cur);
const sym = ({ EUR: '€', USD: '$', GBP: '£', CHF: 'CHF', JPY: '¥', BRL: 'R$' }[cur] || cur);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: Extract the currency-to-symbol mapping into a single shared constant/helper and reuse it here instead of embedding another inline map literal. [custom_rule]

Severity Level: Major ⚠️

Why it matters? ⭐

The file already contains repeated inline currency maps in multiple places, which makes updates error-prone and harder to maintain. This is a real maintainability issue because the same mapping is duplicated rather than sourced from one shared helper or constant.

Rule source 📖

CodeAnt dashboard (rule "agent-persona-maintainability")

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** web/src/dashboard.js
**Line:** 4270:4270
**Comment:**
	*Custom Rule: Extract the currency-to-symbol mapping into a single shared constant/helper and reuse it here instead of embedding another inline map literal.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment thread web/src/dashboard.js
<option value="GBP">GBP (£)</option>
<option value="CHF">CHF</option>
<option value="JPY">JPY (¥)</option>
<option value="BRL">BRL (R$)</option>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggestion: Drive currency dropdown options from the same shared currency configuration used by formatters so all selectors stay in sync automatically. [custom_rule]

Severity Level: Major ⚠️

Why it matters? ⭐

The dropdown option is hardcoded alongside formatter mappings, so adding or changing currencies requires editing multiple separate spots. That duplication is a genuine maintainability concern and is directly visible in the updated file.

Rule source 📖

CodeAnt dashboard (rule "agent-persona-maintainability")

Fix in Cursor Fix in VSCode Claude

(Use Cmd/Ctrl + Click for best experience)

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** web/src/dashboard.js
**Line:** 4594:4594
**Comment:**
	*Custom Rule: Drive currency dropdown options from the same shared currency configuration used by formatters so all selectors stay in sync automatically.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 📜 Skill insights (0)

Context used
✅ Compliance rules (platform): 1 rule

Grey Divider


Action required

1. Deployed build not updated 🐞 Bug ≡ Correctness
Description
This PR adds BRL support in web/src/dashboard.js, but the deployed artifact web/index.html is not
rebuilt, so the running UI will still not show BRL symbol/formatting or the BRL currency dropdown
option. As a result, users won’t actually get BRL support after deployment.
Code

web/src/dashboard.js[4594]

+                                            <option value="BRL">BRL (R$)</option>
Relevance

⭐⭐⭐ High

Multiple merged PRs update web/src and rebuild committed web/index.html artifact (e.g., #165, #203,
#435).

PR-#165
PR-#203
PR-#435

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The build script explicitly states that after editing web/src/*.js, the compiled web/index.html
must be rebuilt and is the file deployed to users. The current web/index.html still contains the
pre-change currency maps/options (no BRL), while web/src/dashboard.js already includes BRL symbol
formatting and adds the BRL option in the currency dropdown—indicating the deployed artifact is out
of sync.

web/Dev/build.sh[10-25]
web/index.html[6568-6575]
web/src/dashboard.js[4268-4272]
web/src/dashboard.js[4586-4595]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The repo deploys `web/index.html` as the compiled single-file SPA, but the PR only updates `web/src/dashboard.js`. Without regenerating `web/index.html`, the deployed UI will still contain the old currency mappings/options (no BRL).

## Issue Context
`web/Dev/build.sh` documents that after editing `web/src/*.js`, you must rebuild because the compiled `web/index.html` is what gets deployed.

## Fix
1. Run `web/Dev/build.sh` to regenerate `web/index.html` from `web/src/*.js`.
2. Commit the updated `web/index.html` output in this PR.

## Fix Focus Areas
- web/Dev/build.sh[10-25]
- web/index.html[6568-6575]
- web/src/dashboard.js[4268-4272]
- web/src/dashboard.js[4586-4595]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

Comment thread web/src/dashboard.js
<option value="GBP">GBP (£)</option>
<option value="CHF">CHF</option>
<option value="JPY">JPY (¥)</option>
<option value="BRL">BRL (R$)</option>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action required

1. Deployed build not updated 🐞 Bug ≡ Correctness

This PR adds BRL support in web/src/dashboard.js, but the deployed artifact web/index.html is not
rebuilt, so the running UI will still not show BRL symbol/formatting or the BRL currency dropdown
option. As a result, users won’t actually get BRL support after deployment.
Agent Prompt
## Issue description
The repo deploys `web/index.html` as the compiled single-file SPA, but the PR only updates `web/src/dashboard.js`. Without regenerating `web/index.html`, the deployed UI will still contain the old currency mappings/options (no BRL).

## Issue Context
`web/Dev/build.sh` documents that after editing `web/src/*.js`, you must rebuild because the compiled `web/index.html` is what gets deployed.

## Fix
1. Run `web/Dev/build.sh` to regenerate `web/index.html` from `web/src/*.js`.
2. Commit the updated `web/index.html` output in this PR.

## Fix Focus Areas
- web/Dev/build.sh[10-25]
- web/index.html[6568-6575]
- web/src/dashboard.js[4268-4272]
- web/src/dashboard.js[4586-4595]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant