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

Added node status by period in filter #120

Merged
merged 3 commits into from
Mar 20, 2020
Merged

Conversation

nmlinaric
Copy link
Member

@nmlinaric nmlinaric commented Mar 18, 2020

Partially covers #57 Return node status in period by filter.

@nmlinaric nmlinaric requested a review from morrigan March 18, 2020 19:02
Copy link
Member

@morrigan morrigan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems also poorly tested so would be good to have more complex test.

return await database.runQuery<NodeUptime>(
`select "isWorking",date_trunc('day', "updatedAt") "timePeriod", (
case when "isWorking" = false
then 'Node is down'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is an API, it's better and expected to use boolean (true/false) so frontend can parse it easier

Copy link
Member Author

@nmlinaric nmlinaric Mar 19, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea was that the response also has a message that can be displayed, like { "isWorking": false, "timePeriod": "2020-03-17T00:00:00.000Z", "nodeStatus": "Node is down" }
Should I just leave the isWorking with timePeriod in the response?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, please don't break current implementation by renaming variable, response should have the same structure

else 'Node is up'
end) as "nodeStatus"
from "NodeUptime"
where "nodeId" = 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1?

order: [['updatedAt', 'DESC']]
});
return await database.runQuery<NodeUptime>(
`select "isWorking",date_trunc('day', "updatedAt") "timePeriod", (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

day hardcoded

end) as "nodeStatus"
from "NodeUptime"
where "nodeId" = 1
and "updatedAt" >= now() - interval '1 year'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 year?filter?

@nmlinaric nmlinaric requested a review from morrigan March 19, 2020 10:12
@morrigan morrigan merged commit edc8b8e into master Mar 20, 2020
@morrigan morrigan deleted the fix/uptime-percentage branch March 20, 2020 10:08
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.

2 participants