In #1848966: Pluggable currency conversion it was decided that Currency.module will not store conversion rates in a database table, because conversion plugins use their own storage/cache. To support some applications, however, we may want to add a submodule that stores all rates in a special database table that is exposed to Views.

Comments

xano’s picture

xano’s picture

I present you Currency conversion database table (currency_conversion_db.module) (please, if someone can think of a better name...)

The module has a database table that it exposes to Views. The table is updated during cron. Here's an example of what you can do with it:

Two issues that need attention:

  • A configuration option needs to be added to control when the table is updated. Every cron run is probably too often.
  • There is no code yet to remove stale rates from the table. The refresh function replaces existing rates for which it has new ones, but rates that cannot be updated are kept in the table.

No tests (yet). There is hardly anything we can test anyway. Most of the code consists of hook implementations, with a small function that puts the rates in the database. We can test the hook implementations using Xtools' blueprint API, though.

xano’s picture

Status: Active » Needs review
xano’s picture

Assigned: Unassigned » xano
StatusFileSize
new6.11 KB

Stale rates are now deleted, and the module name is still long, but makes more sense. The configuration option to schedule cron still needs to be added, though.

xano’s picture

Title: Add a "Currency conversion rate table" submodule » Add a "Currency conversion rate database table" submodule
StatusFileSize
new8.23 KB

The module now features a setting to control how often the table should be updated.

xano’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

xano’s picture

Assigned: xano » Unassigned
karimiehsan1819’s picture

Issue summary: View changes
StatusFileSize
new19.09 KB

hi , i want create a currency exchange rate table that it has own API ( define pravie rate to change )
i also attached a file to clear it .

xano’s picture

Please do not bump closed, fixed issues with new requests. Open a new issue instead.