mirror of
https://github.com/PaiGramTeam/PamGram.git
synced 2024-11-21 21:58:04 +00:00
🐛 Fix empty login data analyse in action log
This commit is contained in:
parent
903e4da085
commit
b923f9bea3
@ -44,19 +44,19 @@ class ActionLogAnalyse(DateUtils):
|
|||||||
|
|
||||||
def get_this_week_duration(self) -> int:
|
def get_this_week_duration(self) -> int:
|
||||||
"""本周时长"""
|
"""本周时长"""
|
||||||
return sum(d.duration.seconds for d in self.this_week_data)
|
return (sum(d.duration.seconds for d in self.this_week_data)) if self.this_week_data else 0
|
||||||
|
|
||||||
def get_last_week_duration(self) -> int:
|
def get_last_week_duration(self) -> int:
|
||||||
"""上周时长"""
|
"""上周时长"""
|
||||||
return sum(d.duration.seconds for d in self.last_week_data)
|
return (sum(d.duration.seconds for d in self.last_week_data)) if self.last_week_data else 0
|
||||||
|
|
||||||
def get_this_month_duration(self) -> int:
|
def get_this_month_duration(self) -> int:
|
||||||
"""本月时长"""
|
"""本月时长"""
|
||||||
return sum(d.duration.seconds for d in self.this_month_data)
|
return (sum(d.duration.seconds for d in self.this_month_data)) if self.this_month_data else 0
|
||||||
|
|
||||||
def get_last_month_duration(self) -> int:
|
def get_last_month_duration(self) -> int:
|
||||||
"""上月时长"""
|
"""上月时长"""
|
||||||
return sum(d.duration.seconds for d in self.last_month_data)
|
return (sum(d.duration.seconds for d in self.last_month_data)) if self.last_month_data else 0
|
||||||
|
|
||||||
def get_this_month_avg_duration(self) -> float:
|
def get_this_month_avg_duration(self) -> float:
|
||||||
"""本月平均时长"""
|
"""本月平均时长"""
|
||||||
@ -70,19 +70,19 @@ class ActionLogAnalyse(DateUtils):
|
|||||||
|
|
||||||
def get_this_week_long_duration(self) -> int:
|
def get_this_week_long_duration(self) -> int:
|
||||||
"""周最长会话"""
|
"""周最长会话"""
|
||||||
return max(d.duration.seconds for d in self.this_week_data)
|
return (max(d.duration.seconds for d in self.this_week_data)) if self.this_week_data else 0
|
||||||
|
|
||||||
def get_this_week_short_duration(self) -> int:
|
def get_this_week_short_duration(self) -> int:
|
||||||
"""周最短会话"""
|
"""周最短会话"""
|
||||||
return min(d.duration.seconds for d in self.this_week_data)
|
return (min(d.duration.seconds for d in self.this_week_data)) if self.this_week_data else 0
|
||||||
|
|
||||||
def get_this_month_long_duration(self) -> int:
|
def get_this_month_long_duration(self) -> int:
|
||||||
"""月最长会话"""
|
"""月最长会话"""
|
||||||
return max(d.duration.seconds for d in self.this_month_data)
|
return (max(d.duration.seconds for d in self.this_month_data)) if self.this_month_data else 0
|
||||||
|
|
||||||
def get_this_month_short_duration(self) -> int:
|
def get_this_month_short_duration(self) -> int:
|
||||||
"""月最短会话"""
|
"""月最短会话"""
|
||||||
return min(d.duration.seconds for d in self.this_month_data)
|
return (min(d.duration.seconds for d in self.this_month_data)) if self.this_month_data else 0
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def format_sec(sec: Union[int, float]) -> str:
|
def format_sec(sec: Union[int, float]) -> str:
|
||||||
|
@ -130,5 +130,5 @@ body {
|
|||||||
}
|
}
|
||||||
|
|
||||||
.small_font {
|
.small_font {
|
||||||
font-size: 16px;
|
font-size: 15px;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user