Sort trackers in stats page

This commit is contained in:
shortcutme 2018-09-02 02:20:02 +02:00
parent 3869cb9bf3
commit 6c2eae29f5
No known key found for this signature in database
GPG key ID: 5B63BAE6CB9613AE

View file

@ -134,7 +134,7 @@ class UiRequestPlugin(object):
# Trackers # Trackers
yield "<br><br><b>Trackers:</b><br>" yield "<br><br><b>Trackers:</b><br>"
yield "<table class='trackers'><tr> <th>address</th> <th>request</th> <th>successive errors</th> <th>last_request</th></tr>" yield "<table class='trackers'><tr> <th>address</th> <th>request</th> <th>successive errors</th> <th>last_request</th></tr>"
for tracker_address, tracker_stat in sys.modules["Site.SiteAnnouncer"].global_stats.iteritems(): for tracker_address, tracker_stat in sorted(sys.modules["Site.SiteAnnouncer"].global_stats.iteritems()):
yield self.formatTableRow([ yield self.formatTableRow([
("%s", tracker_address), ("%s", tracker_address),
("%s", tracker_stat["num_request"]), ("%s", tracker_stat["num_request"]),
@ -147,7 +147,7 @@ class UiRequestPlugin(object):
yield "<br><br><b>Shared trackers:</b><br>" yield "<br><br><b>Shared trackers:</b><br>"
yield "<table class='trackers'><tr> <th>address</th> <th>added</th> <th>found</th> <th>latency</th> <th>successive errors</th> <th>last_success</th></tr>" yield "<table class='trackers'><tr> <th>address</th> <th>added</th> <th>found</th> <th>latency</th> <th>successive errors</th> <th>last_success</th></tr>"
from AnnounceShare import AnnounceSharePlugin from AnnounceShare import AnnounceSharePlugin
for tracker_address, tracker_stat in AnnounceSharePlugin.tracker_storage.getTrackers().iteritems(): for tracker_address, tracker_stat in sorted(AnnounceSharePlugin.tracker_storage.getTrackers().iteritems()):
yield self.formatTableRow([ yield self.formatTableRow([
("%s", tracker_address), ("%s", tracker_address),
("%.0f min ago", min(999, (time.time() - tracker_stat["time_added"]) / 60)), ("%.0f min ago", min(999, (time.time() - tracker_stat["time_added"]) / 60)),