Skip to content

Commit cf71b6d

Browse files
committed
BUGFIX:
- /serverstats does not show the correct period
1 parent 0e3d6ec commit cf71b6d

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

plugins/serverstats/serverstats.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -699,16 +699,20 @@ async def render(self, node: str, period: StatisticsFilter, server_name: Optiona
699699
time_end = series['time'].max()
700700
time_span = time_end - time_start
701701

702-
if time_span <= pd.Timedelta(hours=1):
703-
_period = "Hour"
704-
elif time_span <= pd.Timedelta(days=1):
705-
_period = "Day"
706-
elif time_span <= pd.Timedelta(weeks=1):
707-
_period = "Week"
708-
elif time_span <= pd.Timedelta(days=31):
709-
_period = "Month"
702+
703+
if period.period is None:
704+
if time_span <= pd.Timedelta(hours=1):
705+
_period = "Hour"
706+
elif time_span <= pd.Timedelta(days=1):
707+
_period = "Day"
708+
elif time_span <= pd.Timedelta(weeks=1):
709+
_period = "Week"
710+
elif time_span <= pd.Timedelta(days=31):
711+
_period = "Month"
712+
else:
713+
_period = "Month"
710714
else:
711-
_period = "Month"
715+
_period = period.period.title()
712716

713717
settings = {
714718
"Hour": {

0 commit comments

Comments
 (0)