Bug: Changing Currency while creating a new subscription leads to it applying the same arithmetic regardless of exchange rates
Bug Description
When creating a new subscription with a different currency, the application performs simple arithmetic addition without considering exchange rates, leading to incorrect total calculations.
Steps to Reproduce
- Create a subscription with USD 10.00
- Create another subscription with INR 10.99
- View the total subscriptions value
- Expected: Total should be calculated using proper exchange rates
- Actual: Total shows 20.99 (simple addition without currency conversion)
Current Behavior
- Application adds subscription amounts directly:
10.00 + 10.99 = 20.99
- No currency conversion applied
- Totals are mathematically incorrect when multiple currencies are involved
Expected Behavior
- Convert all currencies to a base currency (e.g., USD) before calculation
- Apply real-time or cached exchange rates
- Display accurate total in the selected base currency
- Example:
USD 10.00 + INR 10.99 (≈ $0.13) = $10.13
Impact
- High Priority: Financial calculations are incorrect
- Affects user trust and decision-making
- Could lead to budget miscalculations
- Multi-currency users receive wrong financial insights
Suggested Solution
- Add currency conversion service (e.g., ExchangeRate-API, Fixer.io)
- Implement base currency selection in user preferences
- Convert all amounts to base currency before calculations
- Cache exchange rates to minimize API calls
- Display original + converted amounts for transparency
Technical Implementation
// Proposed structure
const convertToBaseCurrency = async (amount, fromCurrency, toCurrency) => {
const rate = await getExchangeRate(fromCurrency, toCurrency);
return amount * rate;
};
// Usage in subscription calculations
const totalInBaseCurrency = subscriptions.reduce((total, sub) => {
const convertedAmount = convertToBaseCurrency(sub.amount, sub.currency, userBaseCurrency);
return total + convertedAmount;
}, 0);
Bug: Changing Currency while creating a new subscription leads to it applying the same arithmetic regardless of exchange rates
Bug Description
When creating a new subscription with a different currency, the application performs simple arithmetic addition without considering exchange rates, leading to incorrect total calculations.
Steps to Reproduce
Current Behavior
10.00 + 10.99 = 20.99Expected Behavior
USD 10.00 + INR 10.99 (≈ $0.13) = $10.13Impact
Suggested Solution
Technical Implementation