Openstatus www.openstatus.dev

use floor instead of round (#1537)

authored by

Thibault Le Ouay and committed by
GitHub
11999bb7 86947316

+3 -3
+3 -3
packages/api/src/router/statusPage.utils.ts
··· 787 787 788 788 const total = data.length * MILLISECONDS_PER_DAY; 789 789 790 - return `${Math.round(((total - duration) / total) * 10000) / 100}%`; 790 + return `${Math.floor(((total - duration) / total) * 10000) / 100}%`; 791 791 } 792 792 793 793 if (cardType === "duration") { ··· 799 799 }, 0); 800 800 801 801 const total = data.length * MILLISECONDS_PER_DAY; 802 - return `${Math.round(((total - duration) / total) * 10000) / 100}%`; 802 + return `${Math.floor(((total - duration) / total) * 10000) / 100}%`; 803 803 } 804 804 805 805 const { ok, total } = data.reduce( ··· 814 814 ); 815 815 816 816 if (total === 0) return "100%"; 817 - return `${Math.round((ok / total) * 10000) / 100}%`; 817 + return `${Math.floor((ok / total) * 10000) / 100}%`; 818 818 }