-
Notifications
You must be signed in to change notification settings - Fork 955
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
BE-447 | fetch latest block time to get channels updation time[backend] #449
base: main
Are you sure you want to change the base?
Conversation
app/platform/fabric/Proxy.ts
Outdated
@@ -188,6 +194,31 @@ export class Proxy { | |||
return channel_genesis_hash; | |||
} | |||
|
|||
getLatestBlockTime(channel, currentTime) { | |||
let curBlockTime: any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you be specific about the data type instead of any.
app/platform/fabric/Proxy.ts
Outdated
@@ -188,6 +194,31 @@ export class Proxy { | |||
return channel_genesis_hash; | |||
} | |||
|
|||
getLatestBlockTime(channel, currentTime) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please provide the doc section for the function.
@@ -511,14 +536,20 @@ export class CRUDService { | |||
* @returns | |||
* @memberof CRUDService | |||
*/ | |||
async getChannelsInfo(network_name) { | |||
async getChannelsInfo(network_name, channel_genesis_hash) { | |||
const currentTime = queryDatevalidator(network_name, channel_genesis_hash); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need queryDateValidator for network_name and channel_genesis_hash
@@ -511,14 +536,20 @@ export class CRUDService { | |||
* @returns | |||
* @memberof CRUDService | |||
*/ | |||
async getChannelsInfo(network_name) { | |||
async getChannelsInfo(network_name, channel_genesis_hash) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parameter mismatch when the function is called.
if (page == 1) { | ||
let sqlTxCount: string; | ||
const filterValues = [blockNum, txid, channel_genesis_hash, network_name, from, to]; | ||
const filterValues = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please take care of formatting, as it shouldnt disturb the oriniginal formatting of the file.
@@ -511,14 +536,20 @@ export class CRUDService { | |||
* @returns | |||
* @memberof CRUDService | |||
*/ | |||
async getChannelsInfo(network_name) { | |||
async getChannelsInfo(network_name, channel_genesis_hash) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I see these are the changes to the existing function, please note that it shouldnt impact the application, if this function is called by any other functions.
[network_name] | ||
); | ||
|
||
return channels; | ||
return { channels, currentTime }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to send current time from here
app/platform/fabric/Proxy.ts
Outdated
let agoTime = ''; | ||
if (!channel?.latestdate) return agoTime; | ||
curBlockTime = channel.latestdate; | ||
const dateCurBlock = new Date(curBlockTime); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be good enough to give a meaningful name to the variables like currentBlockDate
What this PR does / why we need it:
To achieve channels updation time on page load, the latest block time needs to be fetched to determine how long ago the channels were updated.
Which issue(s) this PR fixes:
Fixes #447
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation, usage docs, etc.: