diff --git a/mutalyzer/stats.py b/mutalyzer/stats.py index e7228cdfb4e8dbb34a1a59ebcc07654f42679a8c..d8499f120853fee6db1938d33a35e83d745bfc4a 100644 --- a/mutalyzer/stats.py +++ b/mutalyzer/stats.py @@ -48,3 +48,19 @@ def increment_counter(counter): pipe.expire(key, expire) pipe.execute() + + +def get_totals(): + """ + Get the total for all known counters. + + Known counters are just those that have been incremented at least once. + """ + counters = client.keys('counter:*:total') + + pipe = client.pipeline(transaction=False) + for counter in counters: + pipe.get(counter) + + return {counter.split(':')[1]: int(value) + for counter, value in zip(counters, pipe.execute())} diff --git a/mutalyzer/website/templates/about.html b/mutalyzer/website/templates/about.html index 944f433d01e4323e387e67806501534505680592..7036b4da80dcfc97b6c7a10ccc89cddd06af5a63 100644 --- a/mutalyzer/website/templates/about.html +++ b/mutalyzer/website/templates/about.html @@ -39,6 +39,11 @@ Specifications are given by Peter E.M. Taschner and Johan T. den Dunnen. </p> +<p> +Some icons are copyright © +<a href="http://p.yusukekamiyamane.com/">Yusuke Kamiyamane</a>. +</p> + <p> Since references to WWW-sites are not yet acknowledged as citations, please mention @@ -50,9 +55,7 @@ please mention link</a>) when referring to these pages. </p> -<p> -Sponsors: -</p> +<h2>Sponsors</h2> <p> We would like to thank the following organisations for their contribution to @@ -136,9 +139,108 @@ the development of Mutalyzer. </tr> </table> +<h2>Counters</h2> + <p> -Some icons are copyright © -<a href="http://p.yusukekamiyamane.com/">Yusuke Kamiyamane</a>. +We keep simple counters for the use of the various Mutalyzer services, broken +down by interface. </p> +<p> +Note that not all counters were started at the same time, so numbers can not +always be compared directly. +</p> + +<table class="table table-striped"> + <thead> + <tr> + <th rowspan="2" class="text-middle">Service</th> + <th colspan="3" class="text-center">Interface</th> + <th rowspan="2" class="text-middle text-right">Total (all interfaces)</th> + </tr> + <tr> + <th class="text-right">Website</th> + <th class="text-right">Webservice</th> + <th class="text-right">Batch job</th> + </tr> + </thead> + <tbody> + <tr> + <td>Syntax checker</td> + <td class="text-right">{{ '{0:,}'.format(counter_totals['syntax-checker/website']|d(0)) }}</td> + <td class="text-right">{{ '{0:,}'.format(counter_totals['syntax-checker/webservice']|d(0)) }}</td> + <td class="text-right">{{ '{0:,}'.format(counter_totals['syntax-checker/batch']|d(0)) }}</td> + <td class="text-right">{{ '{0:,}'.format(counter_totals['syntax-checker/website']|d(0) + + counter_totals['syntax-checker/webservice']|d(0) + + counter_totals['syntax-checker/batch']|d(0)) }}</td> + </tr> + <tr> + <td>Name checker</td> + <td class="text-right">{{ '{0:,}'.format(counter_totals['name-checker/website']|d(0)) }}</td> + <td class="text-right">{{ '{0:,}'.format(counter_totals['name-checker/webservice']|d(0)) }}</td> + <td class="text-right">{{ '{0:,}'.format(counter_totals['name-checker/batch']|d(0)) }}</td> + <td class="text-right">{{ '{0:,}'.format(counter_totals['name-checker/website']|d(0) + + counter_totals['name-checker/webservice']|d(0) + + counter_totals['name-checker/batch']|d(0)) }}</td> + </tr> + <tr> + <td>Position converter</td> + <td class="text-right">{{ '{0:,}'.format(counter_totals['position-converter/website']|d(0)) }}</td> + <td class="text-right">{{ '{0:,}'.format(counter_totals['position-converter/webservice']|d(0)) }}</td> + <td class="text-right">{{ '{0:,}'.format(counter_totals['position-converter/batch']|d(0)) }}</td> + <td class="text-right">{{ '{0:,}'.format(counter_totals['position-converter/website']|d(0) + + counter_totals['position-converter/webservice']|d(0) + + counter_totals['position-converter/batch']|d(0)) }}</td> + </tr> + <tr> + <td>SNP converter</td> + <td class="text-right">{{ '{0:,}'.format(counter_totals['snp-converter/website']|d(0)) }}</td> + <td class="text-right">{{ '{0:,}'.format(counter_totals['snp-converter/webservice']|d(0)) }}</td> + <td class="text-right">{{ '{0:,}'.format(counter_totals['snp-converter/batch']|d(0)) }}</td> + <td class="text-right">{{ '{0:,}'.format(counter_totals['snp-converter/website']|d(0) + + counter_totals['snp-converter/webservice']|d(0) + + counter_totals['snp-converter/batch']|d(0)) }}</td> + </tr> + <tr> + <td>Batch jobs</td> + <td class="text-right">{{ '{0:,}'.format(counter_totals['batch-job/website']|d(0)) }}</td> + <td class="text-right">{{ '{0:,}'.format(counter_totals['batch-job/webservice']|d(0)) }}</td> + <td class="text-right">N/A</td> + <td class="text-right">{{ '{0:,}'.format(counter_totals['batch-job/website']|d(0) + + counter_totals['batch-job/webservice']|d(0)) }}</td> + </tr> + <tr> + <td>Total (excluding batch jobs)</td> + <td class="text-right">{{ '{0:,}'.format(counter_totals['syntax-checker/website']|d(0) + + counter_totals['name-checker/website']|d(0) + + counter_totals['position-converter/website']|d(0) + + counter_totals['snp-converter/website']|d(0) + + counter_totals['batch-job/website']|d(0)) }}</td> + <td class="text-right">{{ '{0:,}'.format(counter_totals['syntax-checker/webservice']|d(0) + + counter_totals['name-checker/webservice']|d(0) + + counter_totals['position-converter/webservice']|d(0) + + counter_totals['snp-converter/webservice']|d(0) + + counter_totals['batch-job/webservice']|d(0)) }}</td> + <td class="text-right">{{ '{0:,}'.format(counter_totals['syntax-checker/batch']|d(0) + + counter_totals['name-checker/batch']|d(0) + + counter_totals['position-converter/batch']|d(0) + + counter_totals['snp-converter/batch']|d(0)) }}</td> + <td class="text-right">{{ '{0:,}'.format(counter_totals['syntax-checker/website']|d(0) + + counter_totals['syntax-checker/webservice']|d(0) + + counter_totals['syntax-checker/batch']|d(0) + + counter_totals['name-checker/website']|d(0) + + counter_totals['name-checker/webservice']|d(0) + + counter_totals['name-checker/batch']|d(0) + + counter_totals['position-converter/website']|d(0) + + counter_totals['position-converter/webservice']|d(0) + + counter_totals['position-converter/batch']|d(0) + + counter_totals['snp-converter/website']|d(0) + + counter_totals['snp-converter/webservice']|d(0) + + counter_totals['snp-converter/batch']|d(0) + + counter_totals['batch-job/website']|d(0) + + counter_totals['batch-job/webservice']|d(0)) }}</td> + </tr> + </tbody> +</table> + {% endblock content %} diff --git a/mutalyzer/website/templates/static/css/style.css b/mutalyzer/website/templates/static/css/style.css index 5bd961bbe30186dec9c6d1d72a9c92ffbff746a6..99241013150cf74b41c36768882682140c958f87 100644 --- a/mutalyzer/website/templates/static/css/style.css +++ b/mutalyzer/website/templates/static/css/style.css @@ -467,3 +467,7 @@ header.main-header { border-top-left-radius: 0; border-top-right-radius: 0; } + +.table thead > tr > th.text-middle { + vertical-align: middle; +} diff --git a/mutalyzer/website/views.py b/mutalyzer/website/views.py index a84aaf135649026bf3b739f99290a01b2b07d35d..9f47146c07b22a1a74b00b8efe7c83d9c0ed7410 100644 --- a/mutalyzer/website/views.py +++ b/mutalyzer/website/views.py @@ -95,7 +95,7 @@ def about(): """ About page. """ - return render_template('about.html') + return render_template('about.html', counter_totals=stats.get_totals()) @website.route('/name-generator')