Updated stats page

This commit is contained in:
Mark Qvist
2026-05-03 19:55:10 +02:00
parent 49f6a6924d
commit 8acabd95b5
2 changed files with 29 additions and 9 deletions
+1 -1
View File
@@ -1053,7 +1053,7 @@ class NomadNetworkNode():
content_parts.append(f"`F0a0Fetches`f : {f_total:>5} total {self.CLR_DIM}(peak: {f_peak:>3})\n`f")
content_parts.append(f"`Faa0Pushes`f : {p_total:>5} total {self.CLR_DIM}(peak: {p_peak:>3})\n`f")
content_parts.append(f"`F0aaActivity`f : {stats['activity_score']:>5} points\n\n")
content_parts.append(f"{act_color}{act_label}`f over the last {stats['lookback_days']} days ({stats['date_range']})\n\n")
content_parts.append(f"{act_color}{act_label}`f over the last {stats['actual_days']} days ({stats['date_range']})\n\n")
if v_total > 0:
content_parts.append(self.m_heading(f"Views", 2))
+28 -8
View File
@@ -827,17 +827,37 @@ class ReticulumGitNode():
repo_stats["pushes"]["peak"] = count
repo_stats["pushes"]["peak_day"] = day
total_score = ( repo_stats["views"]["total"] * 0.25 +
total_score = ( repo_stats["views"]["total"] * 0.2 +
repo_stats["fetches"]["total"] * 2 +
repo_stats["pushes"]["total"] * 4 )
repo_stats["pushes"]["total"] * 5 )
repo_stats["activity_score"] = int(total_score)
if total_score == 0: repo_stats["activity_level"] = "inactive"
elif total_score < lookback_days * 2: repo_stats["activity_level"] = "low"
elif total_score < lookback_days * 5: repo_stats["activity_level"] = "moderate"
else: repo_stats["activity_level"] = "high"
actual_days = lookback_days
all_activity_days = set()
for stats_dict in (view_stats, fetch_stats, push_stats):
for day, count in stats_dict.items():
if count > 0: all_activity_days.add(day)
if all_activity_days:
earliest_day = min(all_activity_days)
try:
earliest_ts = time.mktime(time.strptime(earliest_day, "%Y-%m-%d"))
span_seconds = now - earliest_ts
actual_days = max(1, int(span_seconds // day_seconds) + 1)
except (ValueError, TypeError): pass
if actual_days > lookback_days: actual_days = lookback_days
daily_score = total_score / actual_days if actual_days > 0 else 0
repo_stats["actual_days"] = actual_days
if daily_score == 0: repo_stats["activity_level"] = "inactive"
elif daily_score < 3: repo_stats["activity_level"] = "low"
elif daily_score < 10: repo_stats["activity_level"] = "moderate"
else: repo_stats["activity_level"] = "high"
return repo_stats
def view_succeeded(self, group_name, repository_name, remote_identity):