Updated fx's with comments to revisit.
This commit is contained in:
1 parent
2f63a13fb8
commit
5481d3f161
1 file changed
+5
@@ -53,6 +53,7 @@ const DetailsPage = () => {
|
|||||||
* Function to calculate uptime duration based on the most recent check.
|
* Function to calculate uptime duration based on the most recent check.
|
||||||
* @param {Array} checks Array of check objects.
|
* @param {Array} checks Array of check objects.
|
||||||
* @returns {string} Uptime duration in hours, minutes, and seconds.
|
* @returns {string} Uptime duration in hours, minutes, and seconds.
|
||||||
|
* TODO - NEED TO REVISIT THIS FOR PROPER LOGIC.
|
||||||
*/
|
*/
|
||||||
const calculateUptimeDuration = (checks) => {
|
const calculateUptimeDuration = (checks) => {
|
||||||
if (!checks || checks.length === 0) {
|
if (!checks || checks.length === 0) {
|
||||||
@@ -68,6 +69,7 @@ const DetailsPage = () => {
|
|||||||
let uptimeDuration = currentTime - lastCheckedTime;
|
let uptimeDuration = currentTime - lastCheckedTime;
|
||||||
|
|
||||||
// Calculate hours, minutes, and seconds from uptime duration
|
// Calculate hours, minutes, and seconds from uptime duration
|
||||||
|
// TODO - NEED TO REVISIT THIS FOR PROPER LOGIC.
|
||||||
let uptimeHours = Math.floor(uptimeDuration / (1000 * 60 * 60));
|
let uptimeHours = Math.floor(uptimeDuration / (1000 * 60 * 60));
|
||||||
uptimeDuration %= (1000 * 60 * 60);
|
uptimeDuration %= (1000 * 60 * 60);
|
||||||
let uptimeMinutes = Math.floor(uptimeDuration / (1000 * 60));
|
let uptimeMinutes = Math.floor(uptimeDuration / (1000 * 60));
|
||||||
@@ -81,6 +83,7 @@ const DetailsPage = () => {
|
|||||||
* Helper function to get timestamp of the most recent check.
|
* Helper function to get timestamp of the most recent check.
|
||||||
* @param {Array} checks Array of check objects.
|
* @param {Array} checks Array of check objects.
|
||||||
* @returns {string} Timestamp of the most recent check.
|
* @returns {string} Timestamp of the most recent check.
|
||||||
|
* TODO - NEED TO REVISIT THIS FOR PROPER LOGIC.
|
||||||
*/
|
*/
|
||||||
const getLastCheckedTimestamp = (checks) => {
|
const getLastCheckedTimestamp = (checks) => {
|
||||||
if (!checks || checks.length === 0) {
|
if (!checks || checks.length === 0) {
|
||||||
@@ -98,6 +101,7 @@ const DetailsPage = () => {
|
|||||||
* Helper function to count incidents (checks with status === false).
|
* Helper function to count incidents (checks with status === false).
|
||||||
* @param {Array} checks Array of check objects.
|
* @param {Array} checks Array of check objects.
|
||||||
* @returns {number} Number of incidents.
|
* @returns {number} Number of incidents.
|
||||||
|
* TODO - NEED TO REVISIT THIS FOR PROPER LOGIC.
|
||||||
*/
|
*/
|
||||||
const countIncidents = (checks) => {
|
const countIncidents = (checks) => {
|
||||||
if (!checks || checks.length === 0) {
|
if (!checks || checks.length === 0) {
|
||||||
@@ -105,6 +109,7 @@ const DetailsPage = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Count checks with status === false
|
// Count checks with status === false
|
||||||
|
// TODO - NEED TO REVISIT THIS FOR PROPER LOGIC.
|
||||||
const incidentCount = checks.filter(check => !check.status).length;
|
const incidentCount = checks.filter(check => !check.status).length;
|
||||||
return incidentCount;
|
return incidentCount;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user