Module: appdb
Branch: master
Commit: 6508c7f430da1d37fa08b296357a50e19e3c0efd
URL: http://source.winehq.org/git/appdb.git/?a=commit;h=6508c7f430da1d37fa08b296…
Author: Alexander Nicolaysen Sørnes <alex(a)thehandofagony.com>
Date: Sat Dec 29 01:31:52 2007 +0100
Allow to calculate rating at a given point in time
---
include/testData.php | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/include/testData.php b/include/testData.php
index 096ae65..f61a75c 100644
--- a/include/testData.php
+++ b/include/testData.php
@@ -741,8 +741,9 @@ class testData{
/* Gets rating info for the selected version: an array with the elements
0 - Rating
- 1 - Wine version */
- public function getRatingInfoForVersionId($iVersionId)
+ 1 - Wine version
+ The $sDate parameter can be used to calculate the rating at a given point in time */
+ public function getRatingInfoForVersionId($iVersionId, $sDate = 'NOW()')
{
$sQuery = "SELECT testedRating,testedDate,testedRelease,versions.id as versionId
FROM testResults, ?.versions WHERE
@@ -753,10 +754,10 @@ class testData{
AND
state = '?'
AND
- TO_DAYS(testedDate) > (TO_DAYS(NOW()) - ?)
+ TO_DAYS(testedDate) > (TO_DAYS(?) - ?)
ORDER BY versions.id DESC,testedDate DESC";
- $hResult = query_parameters($sQuery, BUGZILLA_DB, BUGZILLA_PRODUCT_ID, $iVersionId, 'accepted', TESTDATA_AGED_THRESHOLD);
+ $hResult = query_parameters($sQuery, BUGZILLA_DB, BUGZILLA_PRODUCT_ID, $iVersionId, 'accepted', $sDate, TESTDATA_AGED_THRESHOLD);
$aEntries = array();