Conversation
tdelabro
left a comment
There was a problem hiding this comment.
everything under you .idea should not be committed.
| "disclaimer": "Do not rely on openFDA to make decisions regarding medical care. While we make every effort to ensure that data is accurate, you should assume all results are unvalidated. We may limit or otherwise restrict your access to the API in line with our Terms of Service.", | ||
| "terms": "https://open.fda.gov/terms/", | ||
| "license": "https://open.fda.gov/license/", | ||
| "last_updated": "2022-08-31", |
There was a problem hiding this comment.
This test will fail as soon as they update their database again.
Not sustainable.
You should think about checking something else. Or that the result of get_external_data is more than 22839
|
|
||
|
|
||
| impl<T: Config> Pallet<T> { | ||
| pub fn get_external_data() -> Result<u32, http::Error> { |
There was a problem hiding this comment.
Use more experessive function name.
This one get the total number of FDA enforcement. Call in so it express this
|
|
||
| } | ||
|
|
||
| pub fn parse_to_int(body: JsonValue) -> Option<u32>{ |
There was a problem hiding this comment.
This function does not parse_to_int. It extracts the total number of enforcement from the body. Change the name so it expresses this
|
|
||
| } | ||
|
|
||
| pub fn parse_to_int(body: JsonValue) -> Option<u32>{ |
There was a problem hiding this comment.
this function does not need to be in impl<T: Config> Pallet<T> {}.
It is not runtime dependant and can live outside of this code block
| "derive", | ||
| ] } | ||
| scale-info = { version = "2.1.1", default-features = false, features = ["derive"] } | ||
| frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.28" } |
There was a problem hiding this comment.
In our tutorials we are using substrate on branch polkadot-v0.9.22.
You should use the same one
| @@ -0,0 +1,22 @@ | |||
|
|
|||
There was a problem hiding this comment.
What does this module do?
| ); | ||
|
|
||
|
|
||
| impl frame_system::Config for TestRuntime { |
There was a problem hiding this comment.
split your mocking code in a mock file
|
|
||
| impl<T: Config> Pallet<T>{ | ||
|
|
||
| pub fn send_signed_transaction()-> Result<(),&'static str> { |
There was a problem hiding this comment.
This function feed the chain with an offchain value.
The way it does it is by sending a signed transaction.
Name it based on what it does not how it does it. It will be way easier for students to understand
| @@ -0,0 +1,88 @@ | |||
| #![cfg_attr(not(feature = "std"),no_std)] | |||
There was a problem hiding this comment.
I don't understand what this new section does.
It doesn't add much to what has already been demonstrated in the previous section
| #[pallet::hooks] | ||
| impl<T:Config> Hooks<BlockNumberFor<T>> for Pallet<T>{ | ||
| fn offchain_worker(_n: BlockNumberFor<T>) { | ||
| Self::send_signed_transaction().map_err(|_|log::info!("Failed Function")); |
There was a problem hiding this comment.
When is this one actually called?
Who decides to execute this one?
f480f8e to
344a6dc
Compare
Check the structure