瀏覽代碼

Pluralize cache times correctly.

pull/24/head
Ben Kurtovic 10 年之前
父節點
當前提交
6f574e37a2
共有 1 個文件被更改,包括 4 次插入3 次删除
  1. +4
    -3
      copyvios/checker.py

+ 4
- 3
copyvios/checker.py 查看文件

@@ -167,12 +167,13 @@ def _get_cached_results(page, conn, mode, noskip):
return result

def _format_date(cache_time):
format = lambda n, w: "{0} {1}{2}".format(n, w, "" if n == 1 else "s")
diff = datetime.utcnow() - cache_time
if diff.seconds > 3600:
return "{0} hours".format(diff.seconds / 3600)
return format(diff.seconds / 3600, "hour")
if diff.seconds > 60:
return "{0} minutes".format(diff.seconds / 60)
return "{0} seconds".format(diff.seconds)
return format(diff.seconds / 60, "minute")
return format(diff.seconds, "second")

def _cache_result(page, result, conn, mode):
query1 = "DELETE FROM cache WHERE cache_id = ?"


Loading…
取消
儲存