Kaynağa Gözat

Tweak math; use ndash.

master
Ben Kurtovic 8 yıl önce
ebeveyn
işleme
9ce9421bcf
3 değiştirilmiş dosya ile 5 ekleme ve 4 silme
  1. +1
    -1
      templates/error.mako
  2. +1
    -1
      templates/index.mako
  3. +3
    -2
      tif/calc.py

+ 1
- 1
templates/error.mako Dosyayı Görüntüle

@@ -1,4 +1,4 @@
<%include file="/support/header.mako" args="title='Error - TIF Calculator'"/>
<%include file="/support/header.mako" args="title='Error &ndash; TIF Calculator'"/>
<h2>Error!</h2>
<p>An error occurred. If it hasn't been reported (<a href="https://github.com/earwig/template-influence-factor/issues">try to check</a>), please <a href="https://github.com/earwig/template-influence-factor/issues/new">file an issue</a> or <a href="mailto:wikipedia.earwig@gmail.com">email me</a>. Include the following information:</p>
<div id="error">


+ 1
- 1
templates/index.mako Dosyayı Görüntüle

@@ -24,7 +24,7 @@
<table>
<tr>
<td>TIF</td>
<td>${"{0:.2f}".format(result["tif"])}</td>
<td>${"{0:.2f}".format(result["tif"])} views/min</td>
</tr>
<tr>
<td>Transclusions</td>


+ 3
- 2
tif/calc.py Dosyayı Görüntüle

@@ -64,13 +64,14 @@ def _get_avg_views(site, article):

if "items" not in res:
return None
return sum(item["views"] for item in res["items"]) / float(days)
total_views = sum(item["views"] for item in res["items"])
return total_views / (float(days) * 24 * 60)

def _update_views(cursor, site, title, ns):
cache_life = "7 DAY"
query1 = """SELECT tl_from, page_title
FROM {0}.templatelinks
LEFT JOIN page ON tl_from = page_id
LEFT JOIN {0}.page ON tl_from = page_id
LEFT JOIN cache ON tl_from = cache_id
WHERE tl_title = ? AND tl_namespace = ? AND tl_from_namespace = 0 AND
(cache_id IS NULL OR cache_time < DATE_SUB(NOW(), INTERVAL {1}))"""


Yükleniyor…
İptal
Kaydet