[Git][NTPsec/ntpsec][master] ntpviz: sort and uniq the summary and csv data.

Gary E. Miller gitlab at mg.gitlab.com
Thu Jan 12 00:43:48 UTC 2017


Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
c93bd784 by Gary E. Miller at 2017-01-11T16:42:38-08:00
ntpviz: sort and uniq the summary and csv data.

- - - - -


1 changed file:

- ntpclients/ntpviz


Changes:

=====================================
ntpclients/ntpviz
=====================================
--- a/ntpclients/ntpviz
+++ b/ntpclients/ntpviz
@@ -1747,18 +1747,25 @@ ntpviz</a>, part of the <a href="https://www.ntpsec.org/">NTPsec project</a>
     # dump stats
     csvs = []
     if True:
-        index_buffer += '<div id="Summary">\n' \
-            '<h2><a class="section" href="#Summary">Summary</a></h2>\n'
-        index_buffer += VizStats.table_head
+        stats_to_output = {}
         for stat in stats:
             if [] == stat:
                 continue
             for sta in stat:
                 if sta.skip_summary:
                     continue
-                index_buffer += str(sta.table)
-                csvs.append(sta.csv)
-        # RFC 4180 specifies the mime-type of a csv
+                # This removes duplicates
+                stats_to_output[sta.title] = sta
+
+        index_buffer += '<div id="Summary">\n' \
+            '<h2><a class="section" href="#Summary">Summary</a></h2>\n'
+        index_buffer += VizStats.table_head
+
+        for key in sorted(stats_to_output.keys()):
+            index_buffer += str(stats_to_output[key].table)
+            csvs.append(stats_to_output[key].csv)
+
+        # RFC 4180 specifies the mime-type of a csv: text/csv
         # your webserver should be programmed the same
         index_buffer += VizStats.table_tail
         index_buffer += """\



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/c93bd784cc04085beb2280d8eb1f1ce00c0d4a87
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170112/110eb77d/attachment.html>


More information about the vc mailing list