Giter Club home page Giter Club logo

Comments (8)

strzibny avatar strzibny commented on June 1, 2024 1

@maennchen it's possible hence the question from the beggining. Actually now in iex console this is looking good. Let me find the culprit and don't waste your time for now. I would come back to close it.

from currency-conversion.

maennchen avatar maennchen commented on June 1, 2024

@strzibny you have to configure it as config :[your_app_name], [YourCurrencyModule], source: [SourceModule].

Since you defined your module as CurrencyExchange and not `MyProject.CurrencyExchange your second code example is correct.

from currency-conversion.

strzibny avatar strzibny commented on June 1, 2024

@maennchen That was just copy & edit mistake. Neither variant seems to work for me. I always get the exchange rates from the default source.

from currency-conversion.

maennchen avatar maennchen commented on June 1, 2024

@strzibny Can you IO.inspect what is in config here: https://github.com/jshmrtn/currency-conversion/blob/master/lib/currency_conversion.ex#L117 ?

from currency-conversion.

strzibny avatar strzibny commented on June 1, 2024

It's

[
  base_currency: :USD,
  source_protocol: "https",
  source: CurrencyConversion.Source.Test,
  refresh_interval: :manual,
  seed: &MyProject.CurrencyExchange.seed/1
]

So the configuration seems correct.

from currency-conversion.

strzibny avatar strzibny commented on June 1, 2024

So the problem is in using seed which is preferred. I don't think this is right. Seed is for populating initial data, but not for updates.

# in update_worker.ex
defp refresh(opts, load_callback \\ &load_from_source/1) do

load_callback would be the seed function.

from currency-conversion.

maennchen avatar maennchen commented on June 1, 2024

@strzibny The seed is only called on init, not for manual / automatic refreshes: https://github.com/jshmrtn/currency-conversion/blob/master/lib/currency_conversion/update_worker.ex#L30

I'll do some testing on my own soon. But I honestly think that you're configuring something wrong since a lot of the tests depend on setting a different source: https://github.com/jshmrtn/currency-conversion/blob/master/test/currency_conversion_test.exs#L17

from currency-conversion.

strzibny avatar strzibny commented on June 1, 2024

Ya, I made mistake in some tests and it was ordered dependent. Probably all is well. Sorry about the noise.

from currency-conversion.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.