Skip to content

Commit

Permalink
Merge pull request #812 from openkfw/806-tunesian-dinar
Browse files Browse the repository at this point in the history
Add currency tunisian dinar and ethiopian birr
  • Loading branch information
daniel-arnauer authored Apr 28, 2021
2 parents 9e6abce + 10d4b19 commit 342b157
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

<!-- ## Unreleased -->

<!-- ### Added -->
### Added

- Add currency tunisian dinar to TruBudget [#806](https://github.com/openkfw/TruBudget/issues/806)
- Add currency ethiopian birr to TruBudget [#806](https://github.com/openkfw/TruBudget/issues/813)

<!-- ### Changed -->

Expand Down
4 changes: 3 additions & 1 deletion e2e-test/cypress/support/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ export const currencies = {
USD: { symbol: "$" },
BRL: { symbol: "R$" },
XOF: { symbol: "CFA" },
DKK: { symbol: "kr." }
DKK: { symbol: "kr." },
TND: { symbol: "DT" },
ETB: { symbol: "Br" }
};

export const languages = ["en-gb", "fr", "pt", "de", "ka"];
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/currency.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ const currencies = {
USD: { symbol: "$", format: strings.format.numberFormat },
BRL: { symbol: "R$", format: strings.format.numberFormat },
XOF: { symbol: "CFA", format: strings.format.numberFormat },
DKK: { symbol: "kr.", format: strings.format.numberFormat }
DKK: { symbol: "kr.", format: strings.format.numberFormat },
TND: { symbol: "DT", format: strings.format.numberFormat },
ETB: { symbol: "Br", format: strings.format.numberFormat }
};

export default currencies;
6 changes: 6 additions & 0 deletions frontend/src/getExchangeRates.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,22 @@ export async function getExchangeRates(baseCurrency = "EUR") {
const exchangeRate = getRate(series["0:" + index + ":0:0:0"]);
exchangeRates[currency] = exchangeRate;
}

exchangeRates["EUR"] = 1;
// Hardcoded exchange rates
exchangeRates["XOF"] = 655.957;
exchangeRates["KES"] = 114.882;
exchangeRates["TND"] = 3.2924;
exchangeRates["ETB"] = 47.156;

if (baseCurrency !== "EUR") {
const baseRate = exchangeRates[baseCurrency];
for (const key in exchangeRates) {
exchangeRates[key] = exchangeRates[key] / baseRate;
}
exchangeRates[baseCurrency] = 1;
}

return exchangeRates;
}

Expand Down

0 comments on commit 342b157

Please sign in to comment.