Skip to content

Conversation

@manishdas12
Copy link
Contributor

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?

NONE

Additional documentation, usage docs, etc.:


@manishdas12 manishdas12 requested a review from a team as a code owner September 12, 2023 12:42
}

getLatestBlockTime(channel, currentTime) {
let curBlockTime: any;
Copy link
Contributor

@SunnyAjin SunnyAjin Sep 14, 2023

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.

return channel_genesis_hash;
}

getLatestBlockTime(channel, currentTime) {
Copy link
Contributor

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.

*/
async getChannelsInfo(network_name) {
async getChannelsInfo(network_name, channel_genesis_hash) {
const currentTime = queryDatevalidator(network_name, channel_genesis_hash);
Copy link
Contributor

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

* @memberof CRUDService
*/
async getChannelsInfo(network_name) {
async getChannelsInfo(network_name, channel_genesis_hash) {
Copy link
Contributor

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 = [
Copy link
Contributor

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.

* @memberof CRUDService
*/
async getChannelsInfo(network_name) {
async getChannelsInfo(network_name, channel_genesis_hash) {
Copy link
Contributor

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.

);

return channels;
return { channels, currentTime };
Copy link
Contributor

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

let agoTime = '';
if (!channel?.latestdate) return agoTime;
curBlockTime = channel.latestdate;
const dateCurBlock = new Date(curBlockTime);
Copy link
Contributor

@SunnyAjin SunnyAjin Sep 14, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Backend- Fetch Latest Block Time to get channels updation time

3 participants