summaryrefslogtreecommitdiffstats
path: root/web/lib
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2015-07-14 11:04:35 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2015-07-14 11:17:19 +0200
commit29bffe64ad324ee64376123230ef75b9ba2a5d1a (patch)
tree8296dc0d7a0a762e7017fbf8c61b3dc6a3f9afdf /web/lib
parent881b550dec07fbfbebea2229a6667bcc37eef0f2 (diff)
downloadaurweb-29bffe64ad324ee64376123230ef75b9ba2a5d1a.tar.xz
stats.inc.php: Improve definition of "added"
Until now, a package is listed under "Packages added in the past 7 days" if it was added at most one week ago and if the last modification time matches the submission time stamp. A package is considered "updated" if it was modified at most one week ago and the modification time stamp differs from the submission time stamp. Since we are using Git to store packages now, there always is a delay between package creation (which is handled in git-serve) and last modification (which is handled by git-update). Thus, by the above definitions, almost every package is considered "updated". Since there is no reason for excluding packages that were both added and updated within the past seven days from the "Packages added in the past 7 days" counter, we can drop the check whether the last modification time matches the submission time stamp. Also, to identify packages that were actually updated, we now only count packages that were modified at least one hour after the initial submission. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'web/lib')
-rw-r--r--web/lib/stats.inc.php14
1 files changed, 9 insertions, 5 deletions
diff --git a/web/lib/stats.inc.php b/web/lib/stats.inc.php
index 52637be..203be0a 100644
--- a/web/lib/stats.inc.php
+++ b/web/lib/stats.inc.php
@@ -77,25 +77,29 @@ function general_stats_table() {
$yearstamp = intval(strtotime("-1 year"));
$q = "SELECT COUNT(*) FROM PackageBases ";
- $q.= "WHERE ModifiedTS >= $targstamp ";
- $q.= "AND ModifiedTS = SubmittedTS ";
+ $q.= "WHERE SubmittedTS >= $targstamp ";
$q.= "AND PackagerUID IS NOT NULL";
$add_count = db_cache_value($q, 'add_count');
+ /*
+ * A package whose last modification time differs less than an hour
+ * from the initial submission time is considered new.
+ */
+
$q = "SELECT COUNT(*) FROM PackageBases ";
$q.= "WHERE ModifiedTS >= $targstamp ";
- $q.= "AND ModifiedTS != SubmittedTS ";
+ $q.= "AND ModifiedTS - SubmittedTS >= 3600 ";
$q.= "AND PackagerUID IS NOT NULL";
$update_count = db_cache_value($q, 'update_count');
$q = "SELECT COUNT(*) FROM PackageBases ";
$q.= "WHERE ModifiedTS >= $yearstamp ";
- $q.= "AND ModifiedTS != SubmittedTS ";
+ $q.= "AND ModifiedTS - SubmittedTS >= 3600 ";
$q.= "AND PackagerUID IS NOT NULL";
$update_year_count = db_cache_value($q, 'update_year_count');
$q = "SELECT COUNT(*) FROM PackageBases ";
- $q.= "WHERE ModifiedTS = SubmittedTS ";
+ $q.= "WHERE ModifiedTS - SubmittedTS < 3600 ";
$q.= "AND PackagerUID IS NOT NULL";
$never_update_count = db_cache_value($q, 'never_update_count');