Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BE-447 | fetch latest block time to get channels updation time[backend] #449

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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
@@ -188,6 +194,31 @@ export class Proxy {
return channel_genesis_hash;
}

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.

@@ -188,6 +194,31 @@ export class Proxy {
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.

@@ -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);
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

@@ -511,14 +536,20 @@ export class CRUDService {
* @returns
* @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.

@@ -511,14 +536,20 @@ export class CRUDService {
* @returns
* @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.

[network_name]
);

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