Added a basic live statistics system

This commit is contained in:
Marcel Baumgartner
2023-08-23 17:29:34 +02:00
parent a4be4bdc52
commit 10c017932a
5 changed files with 239 additions and 7 deletions

View File

@@ -156,6 +156,32 @@ public static class Formatter
return (i / (1024D * 1024D)).Round(2) + " GB";
}
}
public static double CalculateAverage(List<double> values)
{
if (values == null || values.Count == 0)
{
throw new ArgumentException("The list cannot be null or empty.");
}
double sum = 0;
foreach (double value in values)
{
sum += value;
}
return sum / values.Count;
}
public static double CalculatePercentage(double part, double total)
{
if (total == 0)
{
return 0;
}
return (part / total) * 100;
}
public static RenderFragment FormatLineBreaks(string content)
{

View File

@@ -410,10 +410,17 @@ public static class Permissions
public static Permission AdminChangelog = new()
{
Index = 59,
Index = 60,
Name = "Admin changelog",
Description = "View the changelog"
};
public static Permission AdminStatisticsLive = new()
{
Index = 61,
Name = "Admin statistics live",
Description = "View the live statistics"
};
public static Permission? FromString(string name)
{